Creating a Custom MQL5 Wizard Module for Trailing Stop Management
Summary
The article shows how to extend the MQL5 Wizard with a custom trailing module derived from the Standard Library’s CExpertTrailing class. It explains the module’s initialization and validation hooks, indicator setup where needed, and the long- and short-position methods that decide whether protection levels should change. The example defines configurable profit and stop-distance parameters and moves a position’s Stop Loss into a loss-reducing zone after price has moved favorably.
To make the class available in the Wizard, the article places its include file under the appropriate Expert folder and describes the class and input parameters using the expected metadata format. Restarting MetaEditor allows the Wizard to discover the new module; the resulting strategy can then be evaluated with the Strategy Tester. The article teaches software integration and a trailing-stop rule, but provides no performance results establishing that the example improves trading outcomes. Stop adjustments remain subject to the EA’s execution and broker conditions.
Key ideas
- A custom trailing module extends CExpertTrailing and overrides methods for long and short positions.
- The trailing methods signal whether Stop Loss or Take Profit values should be modified.
- Parameter validation and indicator initialization are implemented when the module requires them.
- The include-file location and class metadata determine whether the MQL5 Wizard can find the module.
- The example moves the Stop Loss after favorable price movement, but reports no evidence of strategy profitability.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.