Skip to content
All library documents

Implementing Multi-Period Indicator Buffers in MQL5

Article MQL5 articles

Summary

This article extends an MQL5 library for creating and accessing indicator buffers across timeframes. A buffer can be assigned a data period different from the chart period; the library maps its values onto the chart bars whose times fall within the corresponding higher-period bar. This supports multi-period indicators without requiring indicator authors to handle that alignment themselves. The article also explains how buffer indices are assigned independently for each drawing style, so an arrow buffer and a line buffer can each have their own index sequence.

The implementation work includes changes to buffer properties and collection handling, along with a symbol-capacity adjustment for newer MetaTrader builds. The article describes testing the indicator-buffer work, but the supplied excerpt gives no quantitative performance or correctness results. It is a programming and data-display technique for indicator developers, not a trading strategy; the stated next step is extending the library to multi-symbol indicator operation.

Key ideas

  • A buffer can use a data timeframe different from the chart timeframe.
  • Higher-timeframe values are mapped to each lower-timeframe bar contained within the corresponding bar.
  • Indicator buffer indices are tracked separately for each drawing style.
  • The library changes simplify buffer creation and access for multi-period indicators.
  • The article does not report quantitative results that establish trading performance.

Tags

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