Attach EA to a chart window using script

 

Hello,

Using MQL5 script, can I open a chart windows of different instruments in MT5 and attach an EA to that chart? The EA has certain INPUT variables that I need to adjust via the script for each window.

Kind regards,

 
Expert
Expert
  • www.mql5.com
All other files on this page provide examples/scenarios of library application; they are not needed for the operation of the library. Features Example The library use examples/scenarios are attached to the description. ExpertsRemove.mq5 ExpertsReopen.mq5 ChartsClose.mq5 ExpertLoader_Example.mq5 ExpertsChange_Example.mq5 The above examples...
 

Thanks for your helpful answer, I try running the Expert "LondonBreak" using following code, after running the code, the expert is every time attached to the chart, but the expert is in de-active mode, with a red icon next to the Expert's name on the chart, can you perhaps guess what my mistake is:

void OnStart(void)

{

   MqlParam Params[5];

   string sec = "NZDUSD";

   int period = PERIOD_H1;

   

   Params[0].string_value = "Experts\\LondonBreak.ex5";

   

   Params[1].type = TYPE_DOUBLE;

   Params[1].double_value = .1;

   Params[2].integer_value = 400;

   Params[3].integer_value = 300;

   Params[4].integer_value = 4;

   

   EXPERT::Run(ChartOpen(sec, period), Params);

}

 
MOSIZNBD:

Thanks for your helpful answer, I try running the Expert "LondonBreak" using following code, after running the code, the expert is every time attached to the chart, but the expert is in de-active mode, with a red icon next to the Expert's name on the chart, can you perhaps guess what my mistake is:

Unfortunately, I can not check your situation, because I do not have this EA.

Try this before starting the EA.

Platform Settings - Getting Started - MetaTrader 5
Platform Settings - Getting Started - MetaTrader 5
  • www.metatrader5.com
The trading platform provides multiple settings to help you conveniently customize it. Click " Options" in the Tools menu or press "Ctrl+O". Charts — common settings of price charts and parameters of objects management: object selection straight after creation, immediate object configuration, and docking parameters;Trade — default parameters...
Reason: