Skip to content
All library documents

Using Indicator Buffers for Timeframe Updates in Replay Services

Article MQL5 articles

Summary

This article explains how a MetaTrader replay service can use a control indicator’s buffer to communicate current chart information. The indicator refreshes that buffer both when chart events occur and when new quotes trigger calculation, helping keep its contents current even when mouse events are absent. The article also explains why initialization checks were changed to distinguish user-set errors from unrelated terminal errors.

A practical test demonstrates a limitation of reading the buffer through a persistent indicator handle: after a chart timeframe change, the service may continue seeing the value from when the indicator was first attached. The proposed design retrieves the handle dynamically on each call, allowing the service to read updated indicator data. The account is an implementation walkthrough for a replay simulator, not a trading strategy or broad benchmark; its claims concern observed behavior in this particular MQL5 setup, and the excerpt omits much of the test code and results.

Key ideas

  • An indicator can use its buffer to pass chart state to a replay service.
  • Updating the buffer in both calculation and chart-event handlers helps keep its contents current.
  • A persistent indicator handle may expose stale data after a timeframe change.
  • Dynamically retrieving the handle allows the service to access refreshed buffer values.
  • Prototype tests can reveal platform behavior before changes are made to the main system.

Tags

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