/// <summary>
        /// This indicator is a real-time indicator and does not plot against historical data. Plots a histogram splitting volume between trades at the ask or higher and trades at the bid and lower.
        /// </summary>
        /// <returns></returns>
        public BuySellVolume BuySellVolume(Data.IDataSeries input)
        {
            if (cacheBuySellVolume != null)
            {
                for (int idx = 0; idx < cacheBuySellVolume.Length; idx++)
                {
                    if (cacheBuySellVolume[idx].EqualsInput(input))
                    {
                        return(cacheBuySellVolume[idx]);
                    }
                }
            }

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

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

                BuySellVolume[] tmp = new BuySellVolume[cacheBuySellVolume == null ? 1 : cacheBuySellVolume.Length + 1];
                if (cacheBuySellVolume != null)
                {
                    cacheBuySellVolume.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheBuySellVolume  = tmp;
                return(indicator);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// This indicator is a real-time indicator and does not plot against historical data. Plots a histogram splitting volume between trades at the ask or higher and trades at the bid and lower.
        /// </summary>
        /// <returns></returns>
        public BuySellVolume BuySellVolume(Data.IDataSeries input)
        {
            if (cacheBuySellVolume != null)
                for (int idx = 0; idx < cacheBuySellVolume.Length; idx++)
                    if (cacheBuySellVolume[idx].EqualsInput(input))
                        return cacheBuySellVolume[idx];

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

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

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