You then create a strategy to exercise it.
Unfortunately, this isn't going to work. There is a bug in @Shapes.cs (and I suspect in similar circumstances in many other NT files). I've uploaded the simplest of examples to show you where the problem is. Basically, if you take the uploaded ChartControlCrasher indicator and drop it on a chart it will run just fine. It draws a red box. If, however, you take that same indicator and instantiate it via the uploaded AnalyzerKiller strat by opening the strategy analyzer and doing a back test it will crash on the following line of code in @Shapes.cs at line 870.
[FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]startAnchor = [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af]ChartAnchor[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]((owner [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]as[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] Gui.NinjaScript.[/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af]IChartBars[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]).ChartBars.GetTimeByBarIdx(chartControl, currentBar - startBarsAgo), startY, currentBar, chartControl); [/SIZE][/FONT][/SIZE][/FONT]
It's going to be null because there is no chart in the strategy analyzer.
I can work around this by adding a property to my indicator that will allow me to tell the indicator that it is being run via a strat. I then would litter my code with if's to stop any drawing in this case. That, in my opinion is a god-awful hack and one I shouldn't have to do.
BTW, I suspect the same problem would occur if you added the strat to the strategies tab of the control center.
NT code should be smart enough to know when it's being run via the analyzer and IT should just return from anything that needs a non-null ChartControl object.
NT code needs to be bullet proof. In general there is a shocking lack of exception handling. I shouldn't be able to crash NT code using standard NT calls. I don't know where else this problem is lurking, but better you guys fix it than all of us developers having to hack around the problem.
My 2 cents.
Thanks ... Ed

RED X's aren't really cool.
Comment