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

Execution Quality Recorder - expert for MetaTrader 5

Webline Technologies (PVT) LTD
Webline Technologies (PVT) LTD
Founder of Webline Technologies (PVT) LTD. I have 14 years of trading experience and I'm a programmer, building automated trading systems (Expert Advisors) for MetaTrader 5.
Views:
44
Rating:
(1)
Published:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

Every order has a price you asked for and a price you got. The difference is slippage. On fast markets such as gold, indices and crypto it is part of the real cost of every trade, yet the terminal does not report it anywhere. Execution Quality Recorder measures it for every fill on the account, from any Expert Advisor or from manual trading, and shows when, where and how much your fills cost you. It never opens, changes or closes a trade.

Execution Quality Recorder panel for one symbol

One symbol: every fill type of XAUUSD, recorded in the Strategy Tester on real ticks

What it measures for each fill

  • Requested price. Market orders: the price in the order. Pending orders: the order price (the limit price for stop-limit orders). Stop-loss and take-profit exits: the stop-loss or take-profit level of the position.
  • Slippage in points. Positive means against you (bought higher or sold lower than asked), negative means a better fill. Its cost in the account currency, at the real volume of each fill and per 1.00 lot.
  • Spread at the fill, from the tick history.
  • Execution delay of market orders: the time from the server accepting the order to the deal, in milliseconds.

The panel

  • All symbols: one row per symbol, busiest first, with fills, average slippage, share of fills against you, worst fill, average spread and delay. Click a row to open that symbol.
  • One symbol: the same figures for each fill type (market entries, pending entries, stop-loss exits, take-profit exits and other exits) plus a total.
  • Period: today, 7 days, 30 days or all recorded history.
  • Slippage cost of the period in money, using the real volume of each fill.
  • Hour-by-hour heatmap of the server day. For one symbol it shows the average slippage in points: green is better than asked, amber is against you, red is the worst hour. For all symbols it shows the share of fills that went against you.
  • Broker comparison, described below.

Points are never added up across symbols, because a point of gold and a point of a currency pair are different amounts. In the all-symbols view the total row therefore shows only fills, share against you and delay, and the slippage cost below it is added up in money.

Execution Quality Recorder panel for all symbols

All symbols: one row per market, busiest first, recorded in the Strategy Tester on real ticks

Comparing brokers

Each terminal writes a CSV file named after its trade server into the common data folder (Terminal\Common\Files\ExecutionQuality). Run the tool in terminals of two or more brokers on the same computer and every panel lists all of them side by side for the same market: fills, entry slippage, stop-loss exit slippage and spread. Symbols are matched even when brokers add suffixes such as XAUUSD.m or XAUUSD+.

CSV log

One line per fill: time, time_msc, server, symbol, type (MKT_IN, PEND_IN, SL, TP, OTHER), side, volume, requested, filled, slippage_points, slippage_per_lot, delay_ms, spread_points, deal, order, position and magic. The file opens in any spreadsheet for your own analysis.

Inputs

Input Default Description
History to read at start, days (0 = all) 90 How much account history is read when the tool starts. 0 reads the whole history.
Only this magic number (-1 = every trade) -1 -1 records every trade, manual ones included. Any other value records only the trades with that magic number (0 = manual trades).
CSV in the common folder (lets brokers be compared) true Writes the log to the common data folder, which the broker comparison needs.
Alert when a new fill slips more than this, points (0 = off) 0 Shows an alert when a new fill slips more than this against you. 0 turns it off.
Show the panel true false records and writes the CSV without drawing anything.
Panel distance from the left edge, pixels 12 Position of the panel on the chart.
Panel distance from the top edge, pixels 28 Position of the panel on the chart.
Panel size, % 100 Use a smaller value on a small chart.

How to use it

  • Attach it to any one chart of the account. Any symbol and timeframe will do: one copy records every symbol of the account. It opens on the chart's symbol when that symbol has fills.
  • Let your Expert Advisors or your manual trading run as usual. The tool reads the history once at start, then every new deal as it happens.
  • To compare brokers, run it in the terminal of each broker on the same computer, ideally while the same strategy trades on all of them.

Notes

  • Rejected orders and requotes never reach the account history, so they are not counted.
  • The delay is measured on the broker's clock, so it shows the broker's own processing time, not your ping.
  • If the broker keeps no tick history for a symbol, its spread column stays empty.
  • It also runs in the Strategy Tester, but the tester sets a market order's price and time when it fills it. There, market entries show no delay and not the true slippage. Pending orders, stop-loss and take-profit exits are measured as on a live account.

How it was tested

In the Strategy Tester on real ticks with random execution delay, a test Expert Advisor placed 2,450 random market, stop and limit orders with stop loss and take profit on XAUUSD, BTCUSD, EURUSD and NAS100 over one month. The recorder logged all 4,732 deals, and every pending-order, stop-loss and take-profit price it recorded matched the price that had been set. It was then run on a demo account with several symbols to check the panel, the clicks and the CSV log.

Order Error and Retcode Classifier Library Order Error and Retcode Classifier Library

MQL5 include library (#include) for classifying trade server retcodes into retryable transient conditions versus stop-level, margin, volume, or permission rejections. Provides structured diagnostics, suggested retry delays, and formatted log summaries with zero DLLs or WebRequest calls.

Dynamic Break-Even and Trailing Stop Library Dynamic Break-Even and Trailing Stop Library

MQL5 include library (#include) for R-multiple Break-Even+ protection and dynamic or step trailing stop management on open positions. Normalizes Stop Loss levels to SYMBOL_TRADE_TICK_SIZE, enforces broker stops/freeze and spread buffers, supports magic-number and symbol filtering, and requires zero DLLs or WebRequest calls.

Accelerator Oscillator (AC) Accelerator Oscillator (AC)

The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

MACD Signals MACD Signals

Indicator edition for new platform.