How to disable/enable automated/algorithmic trading in MT5 and MT4. - MetaTrader 4 script
//--- 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
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •