Skip to content
All library documents

Passing Chart IDs Safely in a Modular Trading Replay Service

Article MQL5 articles

Summary

This article examines a MetaTrader 5 replay and simulation service whose control indicator needs to place chart objects on the chart opened by the service. The central issue is that ChartID called inside the indicator can differ from the ID returned when the service opens the chart, so using the indicator’s local value can target the wrong window. The proposed fix passes the service-created chart ID through the indicator’s parameters and supplies it to the terminal helper class.

The article also describes restricting changes to those parameters: a detected parameter change triggers deinitialization and the service chart is closed so the service can recognize that it should stop. A video demonstration shows the updated indicator appearing on the chart, while the author notes that the software remains unstable and another interaction issue is unresolved. The piece offers implementation lessons for replay infrastructure and chart lifecycle management, but reports no trading or simulation accuracy results and provides no attached source files in this installment.

Key ideas

  • A service-created chart may have a different ID from the one an indicator obtains locally.
  • Passing the chart ID explicitly lets the indicator direct chart objects to the intended window.
  • Parameter changes can disrupt service state, so the article uses chart closure to trigger service shutdown.
  • The demonstrated change fixes indicator display, but the replay system remains unstable and incomplete.

Tags

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