ChartSaveTemplate error 4003 in strategy tester

 

While running in strategy tester my EA generates a few chart objects.

But if I try to save the chart objects into a template it doesn't create the template file.

void OnDeinit(const int reason)
  {
   ResetLastError();
   if(!ChartSaveTemplate(ChartID(),"lasttest")) Print("ChartSaveTemplate error: ",GetLastError());
  }

Error 4003 is 'Wrong parameter when calling the system function'

Any idea what's going wrong here? My intention is to store the chart objects so I can apply them to a chart outside the visualization.

Reason: