Which line of code is causing the error?
If prints are added after each line, is the last print before the if condition?
Is the last print before DemandPoint.Add()?
Is the last print before drawing a square with DrawSquare()?
With current bar being greater than 9 I would not expect an index error..
It may be that DemandPoint is null.
Can you export a simplified script for me to test? Please remove any code that is not needed to cause the error. (Either remove the DemandPoint.Add() call if this is not causing the error or remove the DrawSquare() call if that is not causing the error)
To export your script do the following:
- Click File -> Utilities -> Export NinjaScript
- Enter a unique name for the file in the value for 'File name:'
- Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
- Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message
By default your exported file will be in the following location:
- (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>
Below is a link to the help guide on Exporting NinjaScripts.
http://www.ninjatrader.com/support/h...nt7/export.htm
Comment