Esempio n. 1
0
        public void GetState(string itemCode, TimeIntervalEnum timeInterval)
        {
            LimitedList <S_CandleItemData> list = null;

            switch (timeInterval)
            {
            case TimeIntervalEnum.Minute_01:
                list = StorageMin01[itemCode];
                break;

            case TimeIntervalEnum.Minute_05:
                list = StorageMin05[itemCode];
                break;

            case TimeIntervalEnum.Minute_10:
                list = StorageMin10[itemCode];
                break;

            case TimeIntervalEnum.Minute_30:
                list = StorageMin30[itemCode];
                break;

            case TimeIntervalEnum.Hour_01:
                list = StorageMin60[itemCode];
                break;

            case TimeIntervalEnum.Hour_02:
                list = StorageMin120[itemCode];
                break;

            case TimeIntervalEnum.Hour_03:
                list = StorageMin180[itemCode];
                break;

            case TimeIntervalEnum.Hour_04:
                list = StorageMin240[itemCode];
                break;

            case TimeIntervalEnum.Hour_05:
                list = StorageMin300[itemCode];
                break;

            case TimeIntervalEnum.Hour_06:
                list = StorageMin360[itemCode];
                break;

            case TimeIntervalEnum.Hour_08:
                list = StorageMin480[itemCode];
                break;

            case TimeIntervalEnum.Hour_12:
                list = StorageMin720[itemCode];
                break;

            case TimeIntervalEnum.Day:
                list = StorageDay[itemCode];
                break;

            case TimeIntervalEnum.Week:
                list = StorageWeek[itemCode];
                break;
            }
            if (list == null)
            {
                return;
            }
            if (list.Count < 10)
            {
                return;
            }


            try
            {
                var result = PPUtils.GetSameUpDownCount(list);
                int cnt    = result.Item1;
                PlusMinusTypeEnum pmType = result.Item2;
                PPEvents.Instance.OnCandleOccurHandler(itemCode, timeInterval, cnt, pmType);
                var massUpDown = PPUtils.GetMassPattern(list);
                PPEvents.Instance.OnCandleMassPatternHandler(itemCode, timeInterval, massUpDown);

                var candleUpDown = PPUtils.GetCandleChartPattern(list, 6);
                if (candleUpDown == Lib.Base.Enums.CandleChartPatternEnum.None)
                {
                    candleUpDown = PPUtils.GetCandleChartPattern(list, 5);
                }
                if (candleUpDown == Lib.Base.Enums.CandleChartPatternEnum.None)
                {
                    candleUpDown = PPUtils.GetCandleChartPattern(list, 4);
                }
                if (candleUpDown == Lib.Base.Enums.CandleChartPatternEnum.None)
                {
                    candleUpDown = PPUtils.GetCandleChartPattern(list, 3);
                }
                PPEvents.Instance.OnCandleChartPatternHandler(itemCode, timeInterval, candleUpDown);
            }
            catch (Exception) { }
        }