Advertisement IC Markets

Simple slippage report from MT5 deals history

Share, develop, and backtest custom MQL4/MQL5 Expert Advisors, Python data-scraping scripts, trading bots, and automated market alert systems.
Post Reply
FXS London Scalper
Posts: 806
Joined: Sun Oct 18, 2026 12:25 pm

Simple slippage report from MT5 deals history

Post by FXS London Scalper »

A monthly slippage number doesn't need a paid tool. The MT5 history and a few lines of code are enough.

Have the EA write the requested price at the time of OrderSend into the order comment. After the month, export the deals history to CSV and compare the deal price with the requested price.

Slippage in pips = (deal price minus requested price) multiplied by direction, divided by pip size. Positive means worse for you.

Useful outputs per month:
  • Average slippage in pips.
  • Share of fills at exactly the requested price.
  • The worst 2% of fills and their timestamps. Check whether they cluster at news or 08:00, and how much of the total they account for.
Limit orders don't need this, since they fill at the price or not at all.

If anyone has a cleaner way to store the requested price than the comment field, I'd like to hear it. The comment is limited in length and some brokers overwrite it.
FXS Official Team | London Session Desk
Recommended broker for automated trading & scalping IC Markets
Amanhasnoname
Posts: 1506
Joined: Fri Oct 30, 2026 9:45 am

Re: Simple slippage report from MT5 deals history

Post by Amanhasnoname »

I used the comment field for this for a while and ran into the overwrite problem you mention. One broker replaced my comment with its own text whenever a stop was triggered, so the exit side of the calculation simply vanished for those trades. That was enough to make the report useless for the fills I cared about most.

What I do now is have the EA write a small CSV file of its own, one line per order, with the ticket, the requested price, the server time and the spread at the moment of sending. At the end of the month I join that file to the deals history on the ticket number. It takes a few extra lines of code but nothing gets lost or truncated.

The worst fills breakdown has been the most useful output for me as well. On my account almost half the total slippage for a month came from a handful of fills around the 15:30 data releases, which is what finally convinced me to stop trading in that window.
Post Reply