Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

How to disable/enable automated/algorithmic trading in MT5 and MT4. - MetaTrader 4 script

author EAcpu | 2 reads | 0 comments |
//--- Import the required dll files
#include #import "user32.dll"
integer getancestor( integer , integer ); #define MT4_WMCMD_expert33020
#import //+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
blank set algorithmic trade to ( boolean true or false) {
//--- Get the current status Boolean value current status = IsTradeAllowed();
//--- If the current state is equal to the input trueFalse, there is no need to switch automatic trading if (current state! = trueFalse) {
//--- Switch automatic trading integer main = GetAncestor(WindowHandle( symbol (), period ()), 2 /*GA_ROOT*/ );
        PostMessageA(main, WM_COMMAND, MT4_WMCMD_EXPERTS, 0 ); //Switch Expert Advisor button }
}



Attachment download

📎 empty_file.mq4 (0.87 KB)

Source: MQL5 #39068

Verification code Refresh