Reconstructing Closed Trades from Paired Deal History
Summary
This document describes a MetaTrader 5 class for rebuilding closed trades from their opening and closing deals in account history. The history is selected over a time range and organized by close time; callers can then enumerate reconstructed trades or select one by index or ticket. The class provides accessors for timestamps, deal and position identifiers, symbol, volume, opening and closing prices, stop loss, take profit, commission, swap, profit, comments, and reasons for opening and closing.
A sample routine demonstrates selecting the history, iterating through the resulting closed trades, and reading those properties for further processing. This can help researchers or developers create trade reports and analyze realized outcomes using paired deal records. The document is an API usage reference, not a performance study or trading strategy. It does not explain how the class handles complex cases such as partial closes, missing history, or differences in account execution, so those behaviors should not be inferred from the interface alone.
Key ideas
- The class pairs opening and closing deals to represent closed trades.
- Users can select historical deals over a specified time range and enumerate reconstructed trades.
- Its accessors expose timing, prices, identifiers, costs, profit, and trade metadata.
- The example illustrates extracting trade records but does not evaluate a trading strategy.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.