Algo Trading and ChartApplyTemplate

 

Hi there!
I have a template that comes with an EA. When I apply this template manually (right click on chart > templates), then Algo Trading is activated in the EA.

But when I apply this template using ChartApplyTemplate(), Algo Trading is off (in the EA settings).

Is there a way to load a template containing an EA, in a way that it doesn't deactivate Algo Trading in the EA settings?

Thank you so much!

 
Someone help please, I would highly appreciate it
 

You may check this link.

Live trading permission cannot be extended for the Expert Advisors launched by applying the template using ChartApplyTemplate() function.

Documentation on MQL5: Chart Operations / ChartApplyTemplate
Documentation on MQL5: Chart Operations / ChartApplyTemplate
  • www.mql5.com
ChartApplyTemplate - Chart Operations - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Arthur Monticelli:

when I apply this template using ChartApplyTemplate(), Algo Trading is off (in the EA settings).

There is no such problem. Verification EA (run on a symbol other than EURUSD).
int OnInit()
{  
  const int Res = MQLInfoInteger(MQL_TRADE_ALLOWED);
  
  if (Res)
  {
    const string NewSymbol = "EURUSD";

    if (_Symbol != NewSymbol)
    {
      Print(ChartSaveTemplate(0, "tmp.tpl"));
      Print(ChartApplyTemplate(ChartOpen(NewSymbol, _Period), "tmp.tpl"));
    }
  }
  else
    Alert("MQL_TRADE_ALLOWED = false");
    
  return(!Res);
}