Commission Per Lot Reverse Engineer
Commission schedules are often vague, buried in a PDF, or simply wrong by the time an account has been open a year and the broker has changed its pricing. The account's own history already contains the truth: every closed trade carries the commission that was actually charged. This script reads it back out and turns it into a per-symbol, per-lot figure. The naive version of this averages each trade's own commission-per-lot ratio across all trades. That is wrong the moment a broker charges a flat per-ticket minimum alongside a per-lot rate, which is common - a 0.01 lot trade then shows an enormous per-lot cost next to a 5.0 lot trade's ordinary one, and a plain average lets the small trades dominate a figure that is supposed to describe the large ones too. This script instead divides total commission by total lots per symbol, the same way the broker's own invoice would, and reports the minimum and maximum per-trade rate alongside it so a flat-fee component is visible rather than smoothed away. Trades with exactly zero commission recorded are counted separately, not folded into the rate as free trades. A broker that prices purely through spread reports zero here for every trade, and that is worth knowing on its own, not disguised as a commission of zero per lot. Notes and limitations - Both platforms only see the history the terminal has actually loaded. If the Account History tab shows fewer trades than expected, right-click it and choose All History before running the script. - A per-lot rate that varies noticeably between trades on the same symbol is flagged with a note; it usually means a flat per-ticket component, a tiered schedule, or a rate that changed partway through the sample - the script does not try to guess which. - Symbols with zero non-zero-commission trades report the rate columns as n/a rather than a false zero. - This is a description of what already happened, not a quote for future trades. A broker can and does change its schedule without notice.
Script · MT5 · v1.0 · Free
About Commission Per Lot Reverse Engineer
Commission Per Lot Reverse Engineer is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 6 settings, such as Magic filter, Symbol filter and From date. MQL source code included.
Files in the download: CommissionPerLotReverseEngineer.ex5, CommissionPerLotReverseEngineer.mq5, CommissionPerLotReverseEngineer.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Magic filter | -1 | Magic filter (-1 = all) - long, MQL5 magic numbers are 64-bit |
| Symbol filter | Symbol filter ("" = all) | |
| From date | 0 | From close time (1970.01.01 = no lower bound) |
| To date | 0 | To close time (1970.01.01 = up to now) |
| Export csv | false | Also write the table to a CSV file |
| Delimiter | DelimiterComma | CSV column separator |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Alerts · MT5 Script · MQL5 Source Code