I've notice that ChartPanel.ChartObjects contains the strategies created in the Chart, and I can explore ChartIndicators container to check if the same Indicator has been declared before skippng AddChartIndicator(myindicator) call but sometimes I got System.InvalidCastException: 'Unable to cast object of type 'NinjaTrader.NinjaScript.Strategies.MyPackage.MySt rategy' to type 'NinjaTrader.NinjaScript.Strategies.Strategy
I can not figure out when this excecptions happens as sometimes works fine.
1. How I can "force" casting to NinjaTrader.NinjaScript.Strategies.Strategy ?
2. Is there another simpler way to detect if the same indicators from another strategies has been added already?
Thanks in advance.
Comment