Skip to content
All library documents

Updating Multi-Timeframe Indicator Data by Bar Time

Article MQL5 articles

Summary

This article describes changes to a DoEasy library’s timeseries classes for indicators that use data from multiple chart periods. Its central design choice is to identify bars by their opening time rather than rely on bar indices. When a new bar appears, the current bar becomes index zero and previous bars shift, making stored indices cumbersome to maintain. Bar times remain stable, so the library can calculate a bar’s time from a requested index and retrieve the corresponding record by time.

The implementation replaces the bar index property with bar time, updates sorting criteria and constructors, and uses time-based history requests. The article also discusses creating and testing a multi-period indicator with real-time updates. This is a data-management and indicator-engineering technique, not a trading signal or performance study. Its value depends on maintaining consistent time-to-index handling and correctly loading history for each symbol and timeframe.

Key ideas

  • Bar indices shift when new bars arrive, while each bar’s opening time remains stable.
  • The library uses bar time as the reference for locating and updating timeseries records.
  • The changes include revising bar properties, sorting criteria, constructors, and history requests.
  • The method supports real-time data updates for indicators that use multiple timeframes.
  • The article describes implementation and testing work rather than evidence of trading performance.

Tags

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