MQL5: Expert Advisor not active after adding to chart via service-script

 

I use a service to open a chart and apply an expert advisor to it, but the EA stays inactive.

#property service
#include <fxsaber\Expert.mqh>

void OnStart()
  {

   MqlParam Params[1];
   string sec = "BTCUSD";
   int period = PERIOD_H1;
   Params[0].string_value = "Experts\\Advisors\\EA Studio Bitcoin H1 45207771.ex5";
   EXPERT::Run(ChartOpen(sec, period), Params);

  }

Automated trading is activated on all levels and works well if I drop the EA on the chart manually.

The service has the checkmark for "algo-trading"

If I go into the properties of the EA that got bound to the chart by my script, I can activate the "allow trading"-switch manually.

Who knows how that´s done via script?

cheers

Documentation on MQL5: Language Basics / Preprocessor / Program Properties (#property)
Documentation on MQL5: Language Basics / Preprocessor / Program Properties (#property)
  • www.mql5.com
Path to the file of an image that will be used as an icon of the EX5 program. Path specification rules are the same as for resources. The property must be specified in the main module with the MQL5 source code. The icon file must be in the ICO format. When launching a script or an Expert Advisor on the chart, the stack of at least 8 MB is...