Skip to content
All library documents

Building a Multi-Instrument Trend-Following Expert Advisor in MQL5

Article MQL5 articles

Summary

This article explains how to structure one MQL5 Expert Advisor to trade multiple instruments from a single chart. Its example uses a Triple Exponential Moving Average (TEMA) trend signal, with independent symbol, trade permission, indicator period, stop loss, take profit, position size, and slippage inputs for each instrument. Signal detection and order handling are separated into functions, and arrays indexed by instrument hold signals and indicator state.

The implementation checks for a new bar before recalculating signals, keeps indicator handles for reuse, verifies that enough price history is available, and retries when buffer data cannot be copied. The article also extends the approach to a system using multiple instruments in a combined signal. Its contribution is primarily software architecture and indicator plumbing; it does not provide performance testing or evidence that the example is profitable. The author notes that adding instruments expands the code and requires sufficient computer resources, while concluding that multi-instrument MQL5 programs follow much the same structure as ordinary single-instrument EAs.

Key ideas

  • A single EA can manage several instruments when each has its own configurable trading parameters.
  • Separating signal calculation from trade execution makes the multi-instrument structure easier to organize.
  • The example generates trend signals from changes in a TEMA indicator across bars.
  • Static arrays indexed by instrument can retain indicator handles and trading signals between ticks.
  • The article explains implementation structure but provides 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.