Пример #1
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 DeltaBuySellVolume DeltaBuySellVolume(Data.IDataSeries input, string counterLocation)
        {
            if (cacheDeltaBuySellVolume != null)
            {
                for (int idx = 0; idx < cacheDeltaBuySellVolume.Length; idx++)
                {
                    if (cacheDeltaBuySellVolume[idx].CounterLocation == counterLocation && cacheDeltaBuySellVolume[idx].EqualsInput(input))
                    {
                        return(cacheDeltaBuySellVolume[idx]);
                    }
                }
            }

            lock (checkDeltaBuySellVolume)
            {
                checkDeltaBuySellVolume.CounterLocation = counterLocation;
                counterLocation = checkDeltaBuySellVolume.CounterLocation;

                if (cacheDeltaBuySellVolume != null)
                {
                    for (int idx = 0; idx < cacheDeltaBuySellVolume.Length; idx++)
                    {
                        if (cacheDeltaBuySellVolume[idx].CounterLocation == counterLocation && cacheDeltaBuySellVolume[idx].EqualsInput(input))
                        {
                            return(cacheDeltaBuySellVolume[idx]);
                        }
                    }
                }

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

                DeltaBuySellVolume[] tmp = new DeltaBuySellVolume[cacheDeltaBuySellVolume == null ? 1 : cacheDeltaBuySellVolume.Length + 1];
                if (cacheDeltaBuySellVolume != null)
                {
                    cacheDeltaBuySellVolume.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]     = indicator;
                cacheDeltaBuySellVolume = tmp;
                return(indicator);
            }
        }
Пример #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 DeltaBuySellVolume DeltaBuySellVolume(Data.IDataSeries input, string counterLocation)
        {
            if (cacheDeltaBuySellVolume != null)
                for (int idx = 0; idx < cacheDeltaBuySellVolume.Length; idx++)
                    if (cacheDeltaBuySellVolume[idx].CounterLocation == counterLocation && cacheDeltaBuySellVolume[idx].EqualsInput(input))
                        return cacheDeltaBuySellVolume[idx];

            lock (checkDeltaBuySellVolume)
            {
                checkDeltaBuySellVolume.CounterLocation = counterLocation;
                counterLocation = checkDeltaBuySellVolume.CounterLocation;

                if (cacheDeltaBuySellVolume != null)
                    for (int idx = 0; idx < cacheDeltaBuySellVolume.Length; idx++)
                        if (cacheDeltaBuySellVolume[idx].CounterLocation == counterLocation && cacheDeltaBuySellVolume[idx].EqualsInput(input))
                            return cacheDeltaBuySellVolume[idx];

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

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