Auto Saving Chart Templates

 

Is it possible for an EA/script to save ALL chart templates that are open in the terminal?

I know the chart operations are available but how do I search for the values of the chart ID's that are open?

If I can pull a list of the open chart ID's can I use ChartSaveTemplate to reference each individually and save them?

I have a terminal with 20+ charts open and want to be able to save everything quickly. I know I could manually save the profile, but I don't think this saves the chart templates info, or does it?

Any advice welcome!

Thanks.

 
James Parker :

Is it possible for an EA/script to save ALL chart templates that are open in the terminal?

I know the chart operations are available but how do I search for the values of the chart ID's that are open?

If I can pull a list of the open chart ID's can I use ChartSaveTemplate to reference each individually and save them?

I have a terminal with 20+ charts open and want to be able to save everything quickly. I know I could manually save the profile, but I don't think this saves the chart templates info, or does it?

Any advice welcome!

Thanks.


I here so save a template with a name "tester.tpl":

//+------------------------------------------------------------------+
//|                                  ChartSaveTemplateTester_tpl.mq5 |
//|                              Copyright © 2016, Vladimir Karputov |
//|                                           http://wmua.ru/slesar/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2016, Vladimir Karputov"
#property link      "http://wmua.ru/slesar/"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   ResetLastError();
//--- save the current chart in a template
   if(!ChartSaveTemplate(0,"tester"))
      MessageBox("Error SaveTemplate #"+IntegerToString(GetLastError()));
   else
      MessageBox("Template \"tester.tpl\" overwritten!");
  }
//+------------------------------------------------------------------+
 
Vladimir Karputov:

I here so save a template with a name "tester.tpl":

Thanks.

Is it possible to save other charts as well, not just the current one?

For example, I load this script to chart ID 0. Can I save templates for chart ID 1 and chart ID 2 on different currency pairs?

 
James Parker :

Thanks.

Is it possible to save other charts as well, not just the current one?

For example, I load this script to chart ID 0. Can I save templates for chart ID 1 and chart ID 2 on different currency pairs ?


Yes. You can. In MQL5, almost everything is possible :).

 
Vladimir Karputov:

Yes. You can. In MQL5, almost everything is possible :).

But what about in MQL4?
 
James Parker:
But what about in MQL4?
It works the same in this case.
 
Alain Verleyen:
It works the same in this case.

Thanks, I've prepared a script to save all open chart templates in one go. I have many charts running at once so will save me lots of time :)

I have another question (sorry if this is a silly one). But are EA parameter settings also saved within the chart template?

Or do I still have to save set files for my EA's?

At the moment I save both templates and set files separately. Wondering if I can ditch the set files and just save templates (if parameters are saved within them).

 
James Parker:

Thanks, I've prepared a script to save all open chart templates in one go. I have many charts running at once so will save me lots of time :)

I have another question (sorry if this is a silly one). But are EA parameter settings also saved within the chart template?

Or do I still have to save set files for my EA's?

At the moment I save both templates and set files separately. Wondering if I can ditch the set files and just save templates (if parameters are saved within them).

Yes they are.
 
Alain Verleyen:
Yes they are.
Excellent!.. Thanks for confirming :)
 

A script is published in which you can specify the name of the template: Chart Save Template

Chart save template