Skip to content
All library documents

Building a Millisecond Market Replay Service for One-Minute Bars

Article MQL5 articles

Summary

This article describes a MetaTrader 5 market replay design that separates one-minute bar construction from the expert advisor. A service reads tick data and updates a custom symbol, while a script starts the service and an EA is intended for later simulation work. The design aims to reduce delays by using millisecond tick timestamps and system tick-count timing, rather than relying on a conventional timer with a coarser interval.

The implementation groups ticks with matching millisecond values, updates OHLC and volume fields, and calculates a delay until the next tick time. The author reports that the service approach achieved bar creation below the targeted minute interval and discusses a further loop-based timing adjustment. However, the article explicitly warns that its timing tests contain conceptual mistakes and should not be taken literally. Operating-system scheduling and platform behavior limit precision, so the reported speed does not guarantee accurate market emulation or consistent timing across setups. Its main value is the architecture and the cautions around measuring replay performance.

Key ideas

  • Separating replay bar construction into a service can reduce coupling with expert-advisor activity.
  • The service builds one-minute bars from tick data and publishes updates to a custom symbol.
  • Millisecond tick fields and system tick-count timing are used to estimate pacing between updates.
  • The author cautions that the timing experiments have flaws and do not establish exact replay timing.
  • Replay speed and timing precision depend on platform and operating-system behavior.

Tags

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