예제 #1
0
        /// <summary>
        /// Tick per Second
        /// </summary>
        /// <returns></returns>
        public ZZQuotesPerBar ZZQuotesPerBar(Data.IDataSeries input)
        {
            if (cacheZZQuotesPerBar != null)
            {
                for (int idx = 0; idx < cacheZZQuotesPerBar.Length; idx++)
                {
                    if (cacheZZQuotesPerBar[idx].EqualsInput(input))
                    {
                        return(cacheZZQuotesPerBar[idx]);
                    }
                }
            }

            lock (checkZZQuotesPerBar)
            {
                if (cacheZZQuotesPerBar != null)
                {
                    for (int idx = 0; idx < cacheZZQuotesPerBar.Length; idx++)
                    {
                        if (cacheZZQuotesPerBar[idx].EqualsInput(input))
                        {
                            return(cacheZZQuotesPerBar[idx]);
                        }
                    }
                }

                ZZQuotesPerBar indicator = new ZZQuotesPerBar();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                ZZQuotesPerBar[] tmp = new ZZQuotesPerBar[cacheZZQuotesPerBar == null ? 1 : cacheZZQuotesPerBar.Length + 1];
                if (cacheZZQuotesPerBar != null)
                {
                    cacheZZQuotesPerBar.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheZZQuotesPerBar = tmp;
                return(indicator);
            }
        }
예제 #2
0
        /// <summary>
        /// Tick per Second
        /// </summary>
        /// <returns></returns>
        public ZZQuotesPerBar ZZQuotesPerBar(Data.IDataSeries input)
        {
            if (cacheZZQuotesPerBar != null)
                for (int idx = 0; idx < cacheZZQuotesPerBar.Length; idx++)
                    if (cacheZZQuotesPerBar[idx].EqualsInput(input))
                        return cacheZZQuotesPerBar[idx];

            lock (checkZZQuotesPerBar)
            {
                if (cacheZZQuotesPerBar != null)
                    for (int idx = 0; idx < cacheZZQuotesPerBar.Length; idx++)
                        if (cacheZZQuotesPerBar[idx].EqualsInput(input))
                            return cacheZZQuotesPerBar[idx];

                ZZQuotesPerBar indicator = new ZZQuotesPerBar();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                Indicators.Add(indicator);
                indicator.SetUp();

                ZZQuotesPerBar[] tmp = new ZZQuotesPerBar[cacheZZQuotesPerBar == null ? 1 : cacheZZQuotesPerBar.Length + 1];
                if (cacheZZQuotesPerBar != null)
                    cacheZZQuotesPerBar.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheZZQuotesPerBar = tmp;
                return indicator;
            }
        }