Skip to content
All library documents

Building Replay Controls for a MetaTrader Market Simulation

Article MQL5 articles

Summary

This installment develops basic controls for a MetaTrader 5 market replay system. The preceding system could generate one-minute bars, but users had little control over playback and could not conveniently pause or choose a starting time. The article sets out a staged approach toward a more usable simulation environment, beginning with a play/pause control and the groundwork for later time selection.

The implementation uses an Expert Advisor to create chart buttons and communicate replay state to a separate service through a terminal global variable. Chart events update that state, while chart redraws and a saved template help ensure the EA and controls are present on the replay chart. The author favors an EA partly because later work will add simulated order handling. The piece is an implementation tutorial rather than a study of trading performance; it does not report simulation accuracy or validation results, and it notes that missing or misconfigured templates can prevent the system from working.

Key ideas

  • The replay project needs controls for pausing playback and choosing a study start time.
  • An Expert Advisor creates play and pause buttons and dispatches chart events.
  • A terminal global variable provides communication between the EA and the replay service.
  • A chart template containing the EA is required for the replay setup described.
  • The controls are an early foundation for later simulation features, including order handling.

Tags

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