Designing Extensible Trailing Stops for an Expert Advisor Framework
Summary
This article explains how to add optional trailing-stop behavior to an object-oriented Expert Advisor framework. It recommends keeping trailing algorithms and their parameters in separate classes rather than adding strategy-specific logic to core strategy or position classes. A shared base class standardizes access to the managed position and a modification method, while derived classes implement individual trailing rules and hold their own settings.
The design connects trailing modules to positions or to the strategy engine, allowing either automatic management or strategy-controlled selection of a trailing rule. The article also describes copying trailing objects and gives examples of classic and moving-average-based trailing, though much of the implementation is omitted in the provided text. It is a software architecture discussion rather than a comparison of trading outcomes: it offers no backtest evidence that a trailing stop improves returns or controls drawdown. Its main lesson is about modularity, configuration, and integration, not a particular trading edge.
Key ideas
- Trailing algorithms can be kept in separate classes so the core strategy remains independent of optional stop management.
- A common base class can standardize position assignment and the method that applies a trailing rule.
- Derived trailing classes can store their own parameters and implement distinct stop-adjustment logic.
- The framework supports automatic trailing or strategy-controlled management of individual positions.
- The article focuses on software design and supplies no evidence that trailing stops improve trading performance.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.