Skip to content
All library documents

Disabling Automated Trading for One MetaTrader Expert Advisor

Article MQL5 code base

Summary

The document describes a Windows message-based script for disabling automated trading on a specific Expert Advisor in MetaTrader. It opens the EA properties dialog, navigates to the Common tab using keyboard shortcuts when needed, locates the auto-trading checkbox, and submits the change. It notes that the command identifier differs between MetaTrader 4 and MetaTrader 5.

A key operational detail is to read the checkbox state before toggling it. The example warns that blindly clicking the control can turn automation back on when it is already disabled, and shows a helper that queries the control state. The approach depends on window handles, tab names, timing delays, and platform-specific UI behavior; the document supplies no testing evidence or robust error handling. UI automation may also be sensitive to platform updates or dialog layout changes, so the state and result should be verified before relying on it to control live trading.

Key ideas

  • The script opens an Expert Advisor's properties dialog and uses Windows messages to interact with it.
  • Keyboard shortcuts navigate to the Common tab when the dialog opens on another tab.
  • Checking the checkbox state before clicking prevents accidentally enabling automation that is already disabled.
  • The method relies on MetaTrader-specific command identifiers and assumptions about dialog timing and layout.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.