System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index at System.ThrowHelper.ThrowArgumentOutOfRangeExceptio n(ExceptionArgument argument, ExceptionResource resource) at NinjaTrader.NinjaScript.Series`1.get_Item(Int32 barsAgo) at NinjaTrader.NinjaScript.Strategies.TradingBot.Init () at NinjaTrader.NinjaScript.Strategies.TradingBot.OnBa rUpdate() Strategy 'Trading Bot': Error on calling 'OnBarUpdate' method on bar -1:
Configuring 1-tick data series.
... else if (State == State.Configure) { AddDataSeries(Data.BarsPeriodType.Tick, 1); } ...
... if (BarsInProgress == 1) { vwap.SyncVWAP(); cumulativeDelta.SyncCumulativeDelta(); } ...
... public void SyncCumulativeDelta() { tradingBot.OrderFlowCumulativeDelta(tradingBot.BarsArray[0], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0) .Update(tradingBot.OrderFlowCumulativeDelta(tradin gBot.BarsArray[0], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0).BarsArray[1].Count - 1, 1); } ...
... public CumulativeDelta(TradingBot tradingBot) { this.tradingBot = tradingBot; this.barsAgo = 0; UpdateDelta(); } ...
... public void UpdateDelta() { OrderFlowCumulativeDelta delta = tradingBot.OrderFlowCumulativeDelta(tradingBot.BarsArray[0], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0); if (delta != null) { sessionDelta = new OHLC( delta.DeltaOpen[barsAgo],[COLOR=#e74c3c] <-- Where exception is thrown.[/COLOR] delta.DeltaHigh[barsAgo], delta.DeltaLow[barsAgo], delta.DeltaClose[barsAgo]); } } ...
Comment