示例#1
0
        public TimeBarItemType(TimeframeUnitOption timeframeUnit)
        {
            this.Mode = BarItemMode.Time;
            string timeframe = Enum.GetName(typeof(TimeframeUnitOption), timeframeUnit);

            this.Value = timeframe.StartsWith("MN") ? 1 : int.Parse(timeframe.Substring(1));
            this.Tag   = timeframe.StartsWith("MN") ? "MN" : timeframe.Substring(0, 1);
        }
示例#2
0
        private void Initialize(BarItem openingBar)
        {
            timeBasedDataFeeds = new Dictionary <string, TimeBasedDataFeed>();

            foreach (BarItemType barItemType in barItemTypeList)
            {
                if (barItemType.Mode == BarItemMode.Time)
                {
                    TimeframeUnitOption timeframeUnit = (TimeframeUnitOption)Enum.Parse(typeof(TimeframeUnitOption), barItemType.Code);
                    TimeBasedDataFeed   dataFeed      = new TimeBasedDataFeed(new TimeBarItemType(timeframeUnit), openingBar, cacheId, cachingEnabled);
                    dataFeed.Restart(openingBar.Time);
                    timeBasedDataFeeds.Add(barItemType.Code, dataFeed);
                }
            }
        }