Is it possible to Load or Save a Template without chart objects, or remove them after it loads?

 

I have an indicator that creates several chart objects as part of the indicator, OBJ_TREND, OBJ_HLINE, etc. I then create a template of a chart using this indicator. I then open a new chart on the same or different timeframe and load this template. The chart objects saved as part of the template are also loaded. Is there a simple way to remove these objects when the template is loaded, or better still not save them as part of the template?

Thanks.

 
robnorthen:

I have an indicator that creates several chart objects as part of the indicator, OBJ_TREND, OBJ_HLINE, etc. I then create a template of a chart using this indicator. I then open a new chart on the same or different timeframe and load this template. The chart objects saved as part of the template are also loaded. Is there a simple way to remove these objects when the template is loaded, or better still not save them as part of the template?

Thanks.

  • It would be hard to remove the objects AFTER the template was applied as yo would need a way to discriminate between "old" and "new" objects.
  • You can't avoid to save them in the template, using the standard MT4/MT5 templates. To do it you would need to build a library to save your own templates.
  • But it's perfectly possible to do it BEFORE applying the template. You only need to edit the template once it is saved, parse it and remove the objects from it.
 

I have had some luck using a script 'delete all objects'

I use the script and save the template with no objects...

Then load the template and the correct objects will appear

Reason: