Building Multi-Symbol, Multi-Timeframe Indicators in MQL5
Summary
This article explains how to build indicator classes that calculate values on symbols or timeframes different from the chart where they are displayed. It describes a base class for multi-symbol, multi-period indicators, specialized classes for standard indicator types, a wrapper for custom indicators, and a shared collection for creating and retrieving them. The core mapping step aligns source indicator values with destination chart bars by their timestamps.
The discussion covers how indicator calculation handles and plotting buffers relate, and how CopyBuffer retrieves data in present-to-past indexing order. It notes that unavailable history may cause an initial request to return no data while the terminal downloads or constructs the required series. When a higher timeframe is displayed on a lower one, a source bar's value can be repeated across matching destination bars; mapping lower-timeframe readings onto a higher-timeframe bar can depend on which matching reading is used. A test indicator demonstrates moving averages calculated on different periods and plotted together, but the article does not assess trading performance or signal quality.
Key ideas
- Multi-symbol and multi-timeframe indicators calculate on one data series and can display results on another chart.
- Source indicator values must be mapped to destination bars by matching their timestamps.
- A higher-timeframe value can be carried across the lower-timeframe bars that fall within its interval.
- CopyBuffer retrieves values from an indicator handle, with data arranged from the present toward the past.
- The demonstration confirms plotting across chart periods, but it does not evaluate trading returns.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.