Those indicators behave as expected when placed on a chart directly.
However, when coding a strategy and adding those indicators using the AddChartIndicator(myIndicator) command, I am getting null reference exceptions in various places that did not occur when the indicator is on the chart directly. These exceptions are mostly a result of the ChartControl instance being null.
Some questions:
1) Is the life cycle of the ChartControl instance of the indicator the same when it is created in the strategy and then added via AddChartIndicator(indicator)?
2) Is the ChartControl instance provided to the strategy the same one as provided to the indicators that are added via the strategy? Would it work to have the strategy pass in it's ChartControl instance to each indicator so it was available in that moment?
3) Is there a point in the life cycle of an indicator where the ChartControl instance is guaranteed to be valid? (in terms of the state transitions that occurred when OnStateChange is called).
4) Are there any differences in the answers to the above questions for NT 7 versus NT 8?
5) In a strategy, what state is best for calling the AddChartIndicator(indicator) method?
Thanks,
Gary
Comment