How to enable "Allow live trading" as a code

 
Hi guys, how can I code that my EA should enable "ALLOW LIVE TRADING BUTTON"? Thank you in advance.
 
macpee:
Hi guys, how can I code that my EA should enable "ALLOW LIVE TRADING BUTTON"? Thank you in advance.


i believe you can't.
but you can add this code it Oninit to disable the EA if the button is not pressed.

int OnInit()
{   
   if (!IsTradeAllowed())
   {
      Alert("Please Enable Auto Trading to run the EA");
      return INIT_FAILED;
   }

   return(INIT_SUCCEEDED);
}
 
Mohamad Zulhairi Baba:


i believe you can't.


Correct, there is no way to do it without using dll calls.

 

It is possible.

I've found this in another forum

Files:
 
Florian Riedrich:

It is possible.

I've found this in another forum

Thank you for the reply. But I am not asking to tell whether it has been enabled/disabled. I am asking for a command that would enable/disable it.
 
honest_knave:

Correct, there is no way to do it without using dll calls.

A much more honest reply
 
macpee:
Thank you for the reply. But I am not asking to tell whether it has been enabled/disabled. I am asking for a command that would enable/disable it.

https://www.mql5.com/en/code/29022

Disable auto trading but ONLY for a specific EA
Disable auto trading but ONLY for a specific EA
  • www.mql5.com
Simple Script to disable the Autotrading for the EA on the chart. If you just want to use the DLL, check the code and comment/uncomment the necessary
Reason: