Download MetaTrader 5
To add comments, please log in or register
You don't know MQL5 but you do know how to sell? The affiliate program is at your service!
Duarte Silva
127
Duarte Silva 2016.01.30 11:37 

Hi,

I making an EA and on that EA I need 3 EMAs displayed on the chart, with different colors. So I have  tried to use ICustom (my topic) and after some suggestions I'm trying to load the template that I have made. I have template on "C:\Users\...\MetaTrader - Install\profiles\templates" and mannually it works but when I try to run the EA on tester it gives an error that it can't find the template:

"...  Load_Template_v27-01-2016 EURUSD,Daily: File 'template_Forex_v2.pdl' not found in C:\Users\...\MetaTrader - Install\profiles\templates"

 I have tried an simple EA just to apllie te template, like on mql4 docs but I have one question:

- Can I load template on strategy tester? It doesn´t work when I run the EA...

- The 3 EMAs used in the EA are due to the EA EMAs or are 3 different EMAs, used by the template and only for display?

- Do I call ChartApplyTemplate on OnInit? 

- When I use a template in an new chart, manually though, it overrides the symbols that I have created with the EA! Will not happend the same when i call the template load function?

 

#property strict
#property indicator_chart_window

int OnInit()
  {
   string terminal_path=TerminalInfoString(TERMINAL_PATH);
   Print("Terminal directory:",terminal_path);
   string terminal_data_path=TerminalInfoString(TERMINAL_DATA_PATH);
   Print("Terminal data directory:",terminal_data_path);
   
   if(FileIsExist("\\template_Forex_v2.tpl"))
     {
      Print("The file template_Forex_v2.tpl found in Files'");
      if(ChartApplyTemplate(0,"\\template_Forex_v2.tpl"))
        {
         Print("The template 'template_Forex_v2.tpl' applied successfully");
        }
      else
         Print("Failed to apply 'template_Forex_v2.pdl', error code ",GetLastError());
     }
   else
     {
      Print("File 'template_Forex_v2.pdl' not found in "
            +TerminalInfoString(TERMINAL_PATH)+"\\profiles\\templates");
     }
   return(INIT_SUCCEEDED);
  }

Thanks.

honest_knave
954
honest_knave 2016.01.30 11:55  

There have been some issues with templates and visual testing. Have a look through these threads and you may find a workaround

https://www.mql5.com/en/forum/155732 

https://www.mql5.com/en/forum/155723 

There are probably other threads too if you search. 

Duarte Silva
127
Duarte Silva 2016.02.03 00:09  
honest_knave:

There have been some issues with templates and visual testing. Have a look through these threads and you may find a workaround

https://www.mql5.com/en/forum/155732 

https://www.mql5.com/en/forum/155723 

There are probably other threads too if you search. 

Thanks honest_knave,

I did read that "Adding templates to visual testing window is denied now" although angevoyageur saying that we can set our template BEFORE the strategy tester start to run. What I don't know is if we set by code on the EA!??

 So, what I have done was creating two templates and call it "Default.tpl" and "Tester.tpl" and I think that its working... the only problem that I'm seeing in this method is that when I optimize the EA I will have to change EMAs indicators on the chart to see if its working ok.

 I am correctly?

Zirkon
123
Zirkon 2016.02.03 13:42  
dbarnabe:

Thanks honest_knave,

I did read that "Adding templates to visual testing window is denied now" although angevoyageur saying that we can set our template BEFORE the strategy tester start to run. What I don't know is if we set by code on the EA!??

 So, what I have done was creating two templates and call it "Default.tpl" and "Tester.tpl" and I think that its working... the only problem that I'm seeing in this method is that when I optimize the EA I will have to change EMAs indicators on the chart to see if its working ok.

 I am correctly?

Yes you are. It's a recurring issue to have the same parameters on your chart and EA.
Duarte Silva
127
Duarte Silva 2016.02.03 23:20  
zirkoner:
Yes you are. It's a recurring issue to have the same parameters on your chart and EA.

Thanks zirkoner.

I am now more cleared!

/
To add comments, please log in or register