Now I would like to begin using the Strategy Analyzer, using Backtest Type = Optimization.
When running the Optimizer, I am getting the following error:
Error on calling 'OnStateChange' method: Object reference not set to an instance of an object.
I have been able to identify the statement which is creating the error. Inside the (State == State.Configure) statement I have some code which validates the parameters that a user enters which can alter the strategy's behavior. One of the parameters that I want to check is the "Break at EOD" parameter which resides in the chart's Data Series. When running the strategy in the optimizer, the Break at EOD parameter is part of the strategy's parameters. As such, the line if (!ChartBars.Properties.IsStableSession) creates the error since I don't CharBars object.
Print ("Here Before"); if (Category == Category.Optimize) { Print("Strategy is running an optimization "); } if (!ChartBars.Properties.IsStableSession) { Log("Make sure \"Break at EOD\" Data Series parameter is enabled/checked. Then re-enable the strategy again.", LogLevel.Alert); return; } Print ("Here after");
I am trying to read Break at EOD that is found inside the strategy's parameters when running the Optimizer. How do I get to (read) Strategy's parameters when running in the Optimizer ?
Comment