chart template not getting applied in newly opened chart

 

Hi

 

Kindly help me with the following code.

I am creating an EA in which I want to open new chart with EURUSD M1 and apply the template in newly opened chart .

EURUSD chart is getting opened , but template is not getting apllied on newly opened chart EURUSD M1.

I have kept the template file in MQL4\Files folder.

 Here is the code

 CurrentOpenedChartId=ChartOpen("EURUSD",1);

     

     if(FileIsExist("MA.tpl"))

     {

      Print("The file MA.tpl found in \\Files'");

      //--- apply template

      if(ChartApplyTemplate(CurrentOpenedChartId,"\\Files\\MA.tpl"))

        {

         Print("The template 'MA.tpl' applied successfully");

        }

      else

         Print("Failed to apply 'MA.tpl', error code ",GetLastError());

     }

    else

     {

      Print("File 'MA.tpl' not found in "

            +TerminalInfoString(TERMINAL_PATH)+"\\MQL4\\Files");

     }

 
if(FileIsExist("MA.tpl"))
if(ChartApplyTemplate(CurrentOpenedChartId,"\\Files\\MA.tpl"))
Not tested, but this was the first thing I saw. One time you check the file only, the other time you pass a folder + file. Maybe you need to fix that.
Reason: