I have a strategy developed and has so far been working since the beginning of the month, I am currently in a live test phase of development so no development changes have been made to the script.
For some reason today I go to enable the strategy on Ninjatrader as I normally would however it is throwing an error in the logs:
Error on calling 'OnBarUpdate' method on bar 22: You are accessing an index with a value that is invalid since it is out of range. I.e accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
I have narrowed it down to an SMA indicator that I am using, which is being created with a secondary data series
OnStateChange() Code:
... else if (State == State.Configure) { AddDataSeries(BarsPeriodType.Minute, 120); } else if (State == State.DataLoaded) { SMA2Hour = SMA(Closes[1], 200); ...
var sma2HourValue0 = SMA2Hour.Value[0]; var sma2HourValue1 = SMA2Hour.Value[1];
This is very worrying since nothing has changed in the script, and I can see the 2 hour data on the charts. This strategy is due to go live at the end of this month however this is a massive problem!
I have also deleted the NinjaTrader.sqllite file in the db folder as this has caused issues previously, I have also restarted the application. This was working fine last night.
Any help would be massively appreciated.
Thank you in advance!
Comment