I'm a NinjaScript newbie, so be comprehensive for the silly question.
I created an indicator using NinjaScript with only the Name and the Description. Than I added a private static field as a counter of the number of instances that are created by NinjaTrader when you add it to a chart. I then defined a default contrustructor (i.e. with no parameters) for the indicator to increment the counter and print its value.
It seems that during the life cycle of an indicator it get instantiated 4 times and destroyed 3 times.
1. when first I open the dialog to add an indicator to the chart
2. when I add the indicator to the chart
3. when I apply the association (or click ok)
4. Before the indicator get truly attached to the chart.
At the end survives just the last instance of the indicator. Did I do something wrong or is the standard way NinjaTrader manages indicators?
Best regards
Comment