Skip to content
All library documents

Dispatching Trading and Chart Events in a Replay Order System

Article MQL5 articles

Summary

This installment explains how a MetaTrader 5 replay system centralizes chart and terminal event handling in a manager class. The dispatch method forwards events to terminal and mouse components in a defined order, then handles keyboard shortcuts for market orders and mouse interactions for creating and positioning entry, stop, and take-profit guide lines. It also describes using modifier keys to distinguish buy and sell actions, and cleaning up temporary chart objects when the interaction ends.

The article emphasizes modularity: concentrating event logic reduces the code in the expert advisor and makes components easier to reuse and debug. It also discusses initialization of weekly scheduling and related market-book and timer setup in the larger system. The material is an implementation walkthrough, not evidence of trading performance. The series is still developing, and the author reports an unexplained error in an unmodified part of the system, so the described design should be treated as work in progress rather than a fully validated order simulator.

Key ideas

  • A manager class can centralize and sequence terminal and mouse event processing for a replay system.
  • Keyboard events can map modifier-key combinations to market buy and sell actions.
  • Mouse movement can display entry, stop, and take-profit levels before an order is created.
  • Separating event handling into reusable components can simplify the expert advisor and debugging.
  • The system remains under development, and the article reports an unresolved error.

Tags

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