示例#1
0
        /// <summary>
        ///  TS Economic News Add On
        /// </summary>
        /// <returns></returns>
        public TSEcoNews TSEcoNews(Data.IDataSeries input, DockingPlace dp)
        {
            checkTSEcoNews.Dp = dp;
            dp = checkTSEcoNews.Dp;

            if (cacheTSEcoNews != null)
            {
                for (int idx = 0; idx < cacheTSEcoNews.Length; idx++)
                {
                    if (cacheTSEcoNews[idx].Dp == dp && cacheTSEcoNews[idx].EqualsInput(input))
                    {
                        return(cacheTSEcoNews[idx]);
                    }
                }
            }

            TSEcoNews indicator = new TSEcoNews();

            indicator.BarsRequired        = BarsRequired;
            indicator.CalculateOnBarClose = CalculateOnBarClose;
            indicator.Input = input;
            indicator.Dp    = dp;
            indicator.SetUp();

            TSEcoNews[] tmp = new TSEcoNews[cacheTSEcoNews == null ? 1 : cacheTSEcoNews.Length + 1];
            if (cacheTSEcoNews != null)
            {
                cacheTSEcoNews.CopyTo(tmp, 0);
            }
            tmp[tmp.Length - 1] = indicator;
            cacheTSEcoNews      = tmp;
            Indicators.Add(indicator);

            return(indicator);
        }
        /// <summary>
        ///  TS Economic News Add On
        /// </summary>
        /// <returns></returns>
        public TSEcoNews TSEcoNews(Data.IDataSeries input, DockingPlace dp)
        {
            checkTSEcoNews.Dp = dp;
            dp = checkTSEcoNews.Dp;

            if (cacheTSEcoNews != null)
                for (int idx = 0; idx < cacheTSEcoNews.Length; idx++)
                    if (cacheTSEcoNews[idx].Dp == dp && cacheTSEcoNews[idx].EqualsInput(input))
                        return cacheTSEcoNews[idx];

            TSEcoNews indicator = new TSEcoNews();
            indicator.BarsRequired = BarsRequired;
            indicator.CalculateOnBarClose = CalculateOnBarClose;
            indicator.Input = input;
            indicator.Dp = dp;
            indicator.SetUp();

            TSEcoNews[] tmp = new TSEcoNews[cacheTSEcoNews == null ? 1 : cacheTSEcoNews.Length + 1];
            if (cacheTSEcoNews != null)
                cacheTSEcoNews.CopyTo(tmp, 0);
            tmp[tmp.Length - 1] = indicator;
            cacheTSEcoNews = tmp;
            Indicators.Add(indicator);

            return indicator;
        }