示例#1
0
        /// <summary>
        /// Check if the point has enough data for checking before and after trend
        /// </summary>
        /// <param name="index"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public static bool CheckTrendPeriod(int index, int count, TrendPeriod trendPeriod)
        {
            int nTrendPeriod = GetTrendPeriod(trendPeriod);

            //unable to verify
            if (index - nTrendPeriod < 0 || index + nTrendPeriod > count)
            {
                return(false);
            }

            return(true);
        }
示例#2
0
        private static int GetTrendPeriod(TrendPeriod trendPeriod)
        {
            int nTrendPeriod = 0;

            switch (trendPeriod)
            {
            case TrendPeriod.Short:
                nTrendPeriod = TrendShortPeriod;
                break;

            case TrendPeriod.Medium:
                nTrendPeriod = TrendMediumPeriod;
                break;

            case TrendPeriod.Long:
                nTrendPeriod = TrendLongPeriod;
                break;

            default:
                break;
            }

            return(nTrendPeriod);
        }
示例#3
0
        public static TrendDirection CheckAfterTrendDirection(DataRowCollection rows, int index, TrendPeriod trendPeriod)
        {
            int nTrendPeriod = GetTrendPeriod(trendPeriod);

            return(CheckTrendDirection(rows, index + 1, index + nTrendPeriod + 1));
        }
示例#4
0
        public static TrendDirection CheckBeforeTrendDirection(DataRowCollection rows, int index, TrendPeriod trendPeriod)
        {
            int nTrendPeriod = GetTrendPeriod(trendPeriod);

            return(CheckTrendDirection(rows, index - nTrendPeriod, index));
        }