Download MetaTrader 5
To add comments, please log in or register
They are already making profit from their signals. Publish your signal and join them!
rakeshranjan
15
rakeshranjan 2015.07.10 06: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");

     }

Ali Akcaagac
169
Ali Akcaagac 2015.07.10 09: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.
/
To add comments, please log in or register