Watch how to download trading robots for free
Find us on Facebook!
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
Scripts

Trade Cost Report: Commission, Swap and Fees per Symbol - script for MetaTrader 5

The Dam Phan
The Dam Phan
I build and test MetaTrader 5 Expert Advisors, with one focus: finding out whether a strategy still works after real trading costs, before you risk money on it.
What I do
• Custom MT5 EAs and indicators from your rules or specification (MQL5, clean commented source code).
Views:
34
Rating:
(1)
Published:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

When a strategy is close to break-even, costs decide whether it makes or loses money. This script reads the deal history of the account and separates the gross trading result from the costs charged by the broker: commission, swap and fees.

How it works

  • Selects the account history for the chosen number of days (or all history).
  • Optionally filters by magic number (0 = manual trades).
  • Per symbol: closed trades, lots opened, gross profit, commission, swap, fees, net result, and the share of the gross result taken by costs.
  • Adds a TOTAL row, prints the table to the Experts log, shows it on the chart and saves a CSV file.
  • Works on hedging and netting accounts (reversal deals are counted).

Inputs

  • InpDays - days of history, 0 = all history (default 90).
  • InpMagic - only this magic number, -1 = all trades, 0 = manual trades (default -1).
  • InpSaveCsv - save the results to MQL5\Files\TradeCostReport.csv (default true).

Notes

The spread is already inside the trade prices, so it is part of the gross figure. Use the report together with a spread measurement (for example by hour of day) to see the full cost picture. The image shows the output on a demo account with a few test trades.

TradeCostReport output on a demo account

Risk Calculator - lot size by risk percent and ATR stop Risk Calculator - lot size by risk percent and ATR stop

On-chart panel that sizes your trade: lot size from your risk % and a stop in points or ATR, with spread, broker-minimum, minimum-lot and margin checks. Calculation only - it never trades.

Symbol and Trading Conditions Inspector Symbol and Trading Conditions Inspector

Displays live symbol specifications, broker trading conditions, account information, spread, trading permissions, session status and margin properties directly on the MT5 chart.

Prop Firm Risk Headroom Monitor Prop Firm Risk Headroom Monitor

Account-wide MT5 prop firm risk monitor that tracks daily and maximum loss headroom, current stop-loss exposure, projected equity and remaining risk capacity.

MACD Signals MACD Signals

Indicator edition for new platform.