Script to change template in MT4

 

I read where I can create a script and assign it to a hotkey to change the template in MT4. 

the Path for the template is :

"C:\Program Files (x86)\OANDA - MetaTrader\Personal_Account\"

and the template is called "!!LINEAR REGRESSION

I figured this should be easy. Not so much. 

The below is my futile attempt.  Anyone notice anything that would cause this not to work ?




//+------------------------------------------------------------------+

//| Script program start function                                    |

//+------------------------------------------------------------------+

void OnStart()

  {

//---

   ChartApplyTemplate(0, TerminalInfoString(TERMINAL_PATH)+"\\templates\\!!LINEAR REGRESSION.tpl");

  }

//+------------------------------------------------------------------+


 
 
Alain Verleyen:
Did you search before posting ?

Yep - that's where I found the above. 

But I'm stumped now.  Did you know the answer?

 
jer99:

Yep - that's where I found the above. 

But I'm stumped now.  Did you know the answer?

See https://www.mql5.com/en/forum/211558
Path + ChartApplyTemplate
Path + ChartApplyTemplate
  • 2017.07.18
  • www.mql5.com
Hi, I'm trying to make an algorithm which will open all charts in selected template based on user inputs...
 

Thanks. That thread doesnt really answer the question except to say that the person cant figure out how to:

1) use ChartApplyTemplate and

2) use the standard templates directory. 


Both of which I'm trying to find an answer for.   

Seems that the use of the standard template directory would be fairly straightforward and logical.  Also seems that the function should work.  I just havent had a lot of luck.

 

It appears that the problem is NOT with the function, but the path. 

Is there anyway to use the default "templates" path?

That way I dont have to move each template to another directory when I want to use it. 

 

How can I declare a template name to change

Reason: