Round Trip Cost Ladder
Traders usually know their spread in pips and their commission in a per-lot figure, but rarely see the two combined with swap into one money total at the size they actually intend to trade. This script builds that table directly: a ladder of lot sizes generated from the symbol's own minimum lot, lot step and maximum lot, so every printed size is one the broker would genuinely accept, never an arbitrary round number that might fall foul of the lot step. Every conversion from price distance or points to money goes through the symbol's own tick value and tick size, never a hardcoded contract size, so metals, indices and JPY crosses price correctly alongside plain FX pairs. Swap can be published either as points or as money-per-lot depending on the broker - MODE_SWAPTYPE is read and honoured rather than assumed, and an optional triple-swap weekday multiplier is applied when today matches the broker's configured rollover day. Commission is read from account history when possible - the most recent closed trade on this symbol - so the figure reflects what this broker genuinely charges rather than a guess, with an input to override it when no closed trade exists yet or the broker's tiered commission has changed. Notes and limitations - Spread is measured at the moment the script runs; on a widening spread the cost actually paid later can be larger than what is printed here. - Commission read from history reflects one broker's most recent closed trade at the time of the run, not a guaranteed current rate - some brokers change commission tiers by account activity or volume. - Swap figures are for one night held; multi-night holding costs scale linearly except across the configured triple-swap day. - The ladder never exceeds the symbol's own MODE_MAXLOT, so a very large InpMaxLadderLot input is silently capped rather than producing a size the broker would reject.
Script · MT4 · v1.0 · Free
About Round Trip Cost Ladder
Round Trip Cost Ladder is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 8 settings, such as Min ladder lot, Max ladder lot and Ladder steps. MQL source code included.
Files in the download: RoundTripCostLadder.mq4, RoundTripCostLadder.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Min ladder lot | 0.0 | Smallest ladder lot (0 = use symbol's MODE_MINLOT) |
| Max ladder lot | 0.0 | Largest ladder lot (0 = ten times the smallest step) |
| Ladder steps | 10 | Number of rungs in the ladder (>= 2) |
| Commission override | -1.0 | Round-turn commission per lot, account currency (-1 = read from account history) |
| Triple swap friday | true | Multiply swap by 3 when today is the broker's triple-swap day |
| Triple swap weekday | 3 | Weekday (0=Sun..6=Sat) that carries triple swap at this broker |
| Export csv | false | Also write the table to a CSV file |
| Csv delimiter | , | CSV delimiter (first character is used) |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Risk & Lot Size · Alerts · MT4 Script · MQL4 Source Code