chart template not getting applied in newly opened chart

Back to topics list To post a new topic, please log in or register
avatar
1
rakeshranjan 2015.07.10 08:16
 

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");

     }

avatar
145
aakcaagac 2015.07.10 11:30 #
 
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.
Back to topics list  

To add comments, please log in or register