In a test script, reduce the code to just what is causing the error.
To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
- Click Tools -> Export -> NinjaScript...
- Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
- Click the 'Export' button
- Enter a unique name for the file in the value for 'File name:'
- Choose a save location -> click Save
- Click OK to clear the export location message
- (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
http://ninjatrader.com/support/helpG...-us/export.htm
However, I recommend instead, providing the output from the output window saved to a text file.
Prints with the information showing the issue from the reduced script.
The print you have have looks ok but is commented out, and would be good information.
Print(string.Format("{0} | From OnBarUpdate BarsInProgress: {1}, {2} {3} {4} {5} {6}", Time[0], BarsInProgress, CurrentBar, Instrument.FullName, BarsPeriod.Value, BarsPeriod.BarsPeriodType, Count ));
Then which ever condition is causing the error would be the only condition that remains and everything else would be deleted.
Prints would be added for the remaining single condition an error. Just as an example:
Print(string.Format("{0} | CurrentBars[2]: {1} > 150", Time[0], CurrentBars[2] ));
Print(string.Format("{0} | CrossAbove(Closes[2], KC2.Lower, 200): {1} > 150", Time[0], CrossAbove(Closes[2], KC2.Lower, 200)));
if ((CurrentBars[2] > 150) && (CrossAbove(Closes[2], KC2.Lower, 200) == true) )
This particular condition I would expect to cause an error. The check is only that CurrentBars[2] has gotten to 150 and the CrossAbove() is using a lookback period of 200. So immediately on bar 151 an error would be hit from an invalid index.
You are correct in that when using added series, MaximumBarsLookBack must be set to MaximumBarsLookBack.Infinite to prevent errors with indexes larger than 256.

. I do not need to mention this explains the excessive break down all the way, or the repetitions under different angles.
Comment