Skip to content
All library documents

Reconstructing Closed Positions from Deals for Chart Review

Article MQL5 articles

Summary

This article explains how to make historical trading activity easier to review in MetaTrader 5 by displaying one closed position at a time on a chart. Since the terminal stores completed deals but does not maintain a separate list of closed positions, the proposed method groups historical deals by their position ID to rebuild each position’s sequence of changes. It describes classes for storing deal, position, and history data, and adds chart labels and tooltips with deal and position details.

Users navigate positions with cursor keys; the chart centers on the selected position, and a modifier key can show additional information. The article describes testing the viewer and reports that history construction took tens of milliseconds in its example logs. This is a trade-history inspection utility, not a signal or performance strategy. Its conclusions concern usability and implementation, and timing may vary with account history and environment.

Key ideas

  • MetaTrader 5 records completed deals but does not keep a separate list of closed positions.
  • Deals can be grouped by position ID to reconstruct each closed position’s history.
  • A chart viewer can show one reconstructed position at a time and provide richer deal and position tooltips.
  • Cursor-key navigation and chart centering make individual positions easier to inspect.
  • The reported construction timings are example implementation results rather than general performance guarantees.

Tags

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