Skip to content
All library documents

Building Minute Bars and Custom Events in an MQL5 Replay System

Article MQL5 articles

Summary

The article extends a MetaTrader replay service with an option to show or hide the construction of bars. To prepare replay data efficiently, it builds one-minute bars as tick files are read instead of repeatedly calling the existing event routine, which the author says would add delay across many ticks. The bar builder initializes a new bar when a tick enters a new minute, then updates its close, high, low, and volume as further ticks arrive.

The article also describes using custom chart events to report when the replay service is busy or ready, allowing an indicator to coordinate with it without relying on timers. The material is an implementation walkthrough supported by code examples, not a trading strategy or performance study. Some details are omitted in the supplied text, and the author cautions that timer use in indicators can affect other indicators; the discussion is specific to the MQL5 replay architecture.

Key ideas

  • The replay service adds a setting to show or suppress visual bar construction.
  • One-minute bars are assembled incrementally while tick data is loaded.
  • Building bars directly from ticks avoids repeatedly invoking a routine that adds delay.
  • Custom chart events let an indicator detect when the replay service is busy or ready.
  • The article addresses replay software behavior and does not evaluate trading performance.

Tags

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