Watch how to download trading robots for free
Find us on Telegram!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Experts

Round Trip Cost Reconciler MT5 - expert for MetaTrader 5

Usamah
Usamah
I develop MetaTrader 5 Expert Advisors and trading utilities with a focus on reliable execution, risk controls, and broker compatibility.
Views:
66
Published:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance
Round Trip Cost Reconciler MT5 workflow overview

Round Trip Cost Reconciler is a free, read-only MT5 utility for traders and developers who need more than a raw deal-history export.

It writes one CSV with filtered deal records and a second CSV that groups buy/sell deals by DEAL_POSITION_ID. Partial fills are combined into volume-weighted entry and exit prices, while broker-recorded commission, swap, and fee remain visible separately from gross trading result.

WHAT IT REPORTS

• Deal, order, and position identifiers.
• Symbol, magic number, direction, entry type, time, price, and volume.
• Broker-recorded profit, commission, swap, and fee.
• Total entry and exit volume per position identifier.
• Volume-weighted entry and exit prices.
• Gross result, total costs, net result, deal count, and lifecycle status.

LIFECYCLE STATUSES

• COMPLETE: entry and exit volumes match within tolerance.
• OPEN_OR_INCOMPLETE: entry volume remains unmatched.
• EXCESS_EXIT: exit volume exceeds recorded entry volume.
• COMPLEX_REVERSAL: an INOUT reversal exists, so the program does not invent a simple allocation.

INPUTS

• InpDaysBack: history window from 1 to 3650 days.
• InpSymbolScope: current chart symbol or all symbols.
• InpMagicFilter: -1 for every magic number, otherwise one exact non-negative magic.
• InpDealsFileName and InpPositionsFileName: two distinct safe CSV filenames.
• InpUseCommonFolder: Common Files folder when enabled.
• InpDelimiter: comma (44) or semicolon (59).

SETUP

1. Compile RoundTripCostReconcilerMT5.mq5 with RoundTripCostCore.mqh in the same folder.
2. Attach the Expert Advisor to any chart.
3. Select the history scope and optional exact magic filter.
4. Choose two distinct safe CSV filenames.
5. Read the Experts log, then retrieve the CSV files from Common Files or the terminal Files folder.

SAFETY AND LIMITATIONS

The utility only reads account history and writes local CSV files. It does not place, modify, delete, or close orders; it does not use DLLs, WebRequest, or an external service.

Results depend on the history available from the connected terminal and broker. Reversals are deliberately classified as complex instead of being forced into a misleading simple round trip. This is an accounting and diagnostic aid, not a profit or tax guarantee.
Stop Geometry Visualizer MT5 Stop Geometry Visualizer MT5

Read-only MT5 indicator that visualizes broker Stops Level and Freeze Level references on the chart.

Trade Transaction Trace Logger MT5 Trade Transaction Trace Logger MT5

Read-only OnTradeTransaction logger that records MT5 order, deal and position lifecycle events to local CSV and the Experts Journal.

Broker Session Schedule Inspector MT5 Broker Session Schedule Inspector MT5

Read-only broker-native trading-session inspector with current status, next transition, multi-symbol scope, and CSV export.

MACD Signals MACD Signals

Indicator edition for new platform.