Skip to content
All library documents

Handling Sparse Arrow Buffers in Multi-Timeframe Indicators

Article MQL5 articles

Summary

The article explains how to adapt multi-symbol, multi-timeframe indicator classes to indicators that draw arrows only on selected bars. Their buffers contain empty values elsewhere, so copying every lower-timeframe value onto a higher-timeframe bar can erase an arrow already copied from another bar. The proposed handling preserves existing nonempty values and replaces them only with another nonempty reading, leaving the latest applicable arrow on the higher-timeframe bar.

It also addresses arrows produced several bars back by higher-timeframe indicators. Since their location may vary by indicator, the class gains a configurable starting bar for searching and copying values; standard indicators can use a known index. Temporary data and time arrays are resized for the requested calculation window and reused. The article reports compiling and running an example with fractal indicators across chart periods, showing arrows carried between timeframes. This is an implementation-focused treatment of indicator display and data copying, not an evaluation of trading performance.

Key ideas

  • Arrow indicator buffers are sparse, so empty values must not overwrite valid values when timeframes are combined.
  • When aggregating lower-timeframe arrows, retaining nonempty values allows multiple events within a higher-timeframe bar to be represented.
  • Higher-timeframe arrows may occur beyond the most recent bars, so the search start index should be configurable.
  • Reusing resized temporary arrays can avoid repeated memory allocation during indicator data copying.
  • The example demonstrates indicator behavior across timeframes but does not assess trading results.

Tags

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