Skip to content
All library documents

Decoupling Position Displays for Replay and Live Trading

Article MQL5 articles

Summary

This installment describes adapting a MetaTrader position indicator so it can operate in a market replay or simulation environment that has no access to live terminal positions. The central design change is to remove direct position-data dependencies from the graphical trade-elements class. The symbol name is passed into the class and stored, while position-specific values are instead supplied through event handling and class state.

The article also discusses keeping the indicator’s controls useful for managing displayed positions, including focus, view changes, and price adjustments, and describes visual feedback for a failed trade request. It frames these changes as preparation for using the position view in both simulation and live trading. The evidence is implementation guidance and code excerpts, not a trading-performance evaluation; the piece concerns software architecture and interface behavior rather than a market signal or tested strategy.

Key ideas

  • A replay service cannot rely on terminal calls that retrieve live positions, so those dependencies must be isolated.
  • Passing the symbol into the trade-elements class removes the need to query it from the current position.
  • The position indicator communicates through chart events to update focus, display mode, and editable price levels.
  • Visual feedback can alert a user when a requested trade adjustment cannot be sent.
  • The article offers implementation guidance but 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.