How to disable or enable button autotrading from code?

Hello everyone, I wanted to know if there is a method or code to disable or enable the button “Autotrading” high on the MT4 thanks.

No code to override it.

and what’s about active/disable EAs?
maybe we can push this button “auto trading” through win API? any ideas?

This is possible to “click” button by WinAPI.

can you say how to do that?

Hello everyone and thanks for asking.

After much searching on and off the site MQL5 I managed to find this old post on I tried and it works. when the variable is changed Run the code enabled if it is disabled autorading and vice versa.

thank you all.

Using different API tools its possible. That means stimulating mouse clicks on the area of the Autotrade button. U cant use mql for that but other eg VB, C# java etc. Your Mt4 terminal must be maximized else it will miss the clicks. U wanted to enable or disable Auto trade? That is also possible if u can read pixel colors. Windows api mouse calls can determine the pixel color at screen x,y. Check the color code of the little green arrow and the red square on the Autotrade button. Wen its red then it means it was disabled so then it will be enabled or else click again simulation to disable trade

You can’t disable autotrading but you can close all charts in the mt4/mt5, effectively eliminating all eas from execution.

void CloseAllCharts()
   long chid=ChartFirst();
   long pom;
   for(int i=0;i<50;i++) 
      pom  = ChartNext(chid);
      if(chid == -1) return;