The log file is reporting an error when I try to reload ninjascripts using F5. I am running two independent strategies at the same time. Both strategies use AddChartIndicator to display stochastic and MACD indicators. When reloading the scripts, on occasion, the log reports the following error for the stochastic indicator:
Indicator 'Stochastic': Error on calling 'SetState' method: Object reference not set to an instance of an object.
The log also reports a similar error for the MACD indicator.
I created a simplified script to demonstrate the error (actually leveraging a test script from a previous post - see attached). The error is sporadic and may occur on the third reload attempt or it may occur on the 50th. The number of attempts required is inconsistent.
I am running: version 8.0.5.2 64-bit of the Ninjatrader platform.
To reproduce the problem, I performed the following steps. I have also attached the screenshots associated with most of the steps.
- I opened a 300 tick window for the 6E 06-17 with a specific end date (see Data Series window screenshot).
- I added the 'DetectDrawingObject' script twice to simulate the two independent scripts I am normally running. I kept the default input values for the first and changed the stochastic values for the second (see "Strategy Window-prior to error" screenshot).
- After enabling both strategies, I checked the Indicator window which correctly showed the indicators added by the strategy (refer to the "Indicator Window - prior to the error" screenshot).
- On the third attempt at reloading the indicator, the log reported the errors described above (refer to the screenshot of the log).
- After the error, the Indicator window displays two new entries for the Stochastic and MACD indicators in addition to the ones previously added. The two new indicators do not appear to be associated with the 300-tick bar (refer to "Indicator Window - after error" screenshot)
- I next removed the two strategies from the strategy window.
- The chart window still retained two panes for the MACD and Stochastic indicators, but the panes were blank(refer to "Chart Window - after removing strategies" screenshot).
- Returning to the Indicator window, the two new indicators that were added after the error still remained but the original Stochastic and MACD indicators were automatically removed. Attempting to manually remove the remaining indicators resulted in an error stating the indicators were added by a strategy.(refer to "Indicator Window - error attempting to remove the indicator" screenshot).
I'm not sure what is causing the issue, but any help would be appreciated.
Comment