Skip to content
All library documents

Modular Expert Advisors with Pluggable Trading Components

Article MQL5 articles

Summary

This article describes modular programming for trading robots: divide an expert advisor into independent components with clear inputs and outputs so one component can be replaced without rewriting the rest. It recommends keeping core trading functions in a main expert advisor and using external indicator modules to add or adapt functionality. The design guidance emphasizes functional completeness, logical independence, limited data exchange, and decisions managed at the top level.

A sample multi-module expert advisor starts with Bollinger-band reversal logic and can integrate separate modules for position sizing, stop loss, take profit, trailing stops, signal generation, signal filtering, and breakeven levels. Modules communicate values through indicator buffers, and the main program can use or ignore them. The article also discusses documentation for third-party module developers and a signal module that optimizes its parameters, noting that this optimization delays trading while it runs. The example is described as a primitive concept, and optimization of modular projects remains an open issue; no trading performance evidence is supplied.

Key ideas

  • Modularity allows a trading component to be replaced or extended while limiting changes to the rest of the expert advisor.
  • The main expert advisor should retain project management and core trading functions, with external modules adding optional capabilities.
  • Indicator buffers can provide a simple interface for modules to return values such as lot size, stop distance, or signals.
  • A multi-module design can separate risk controls, trade management, signal generation, and filtering.
  • Automatic optimization can interrupt trading while it runs, and the article leaves broader optimization questions unresolved.

Tags

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