Skip to content
All library documents

Designing Cross-Platform Expert Advisors with Modular Classes

Article MQL5 articles

Summary

The article presents a class-based structure for organizing expert advisors that can run across MQL4 and MQL5. A central expert advisor class coordinates strategy components such as signals, money management, order handling, time filters, symbols, and candle management. A container class is intended to manage multiple expert advisor instances.

Initialization creates and connects these components, then validates their settings. The design also covers event handling, detecting new bars by comparing candle state, and saving or loading volatile data so an advisor can recover state. Trading options include processing every tick or only new candles, limiting entries per candle, and reversing positions when signals change. The material is primarily software architecture guidance rather than evidence for a trading strategy; it provides implementation patterns and examples but no performance results. Correctness still depends on the component implementations and testing the resulting advisor in its intended platform and market conditions.

Key ideas

  • A central advisor class coordinates signal, order, money, time, symbol, and candle components.
  • Initialization provides a single place to create components and validate their configurations.
  • New-bar detection can be handled by tracking the current candle against its prior state.
  • Persistence methods support saving and restoring advisor data across interruptions.
  • The framework exposes controls for tick processing, trade frequency per candle, and position reversal.

Tags

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