Advertisement IC Markets

Latency in the tester versus latency in reality

Share, develop, and backtest custom MQL4/MQL5 Expert Advisors, Python data-scraping scripts, trading bots, and automated market alert systems.
Post Reply
Fairman
Posts: 6955
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Latency in the tester versus latency in reality

Post by Fairman »

Latency in the tester versus latency in reality

Backtests typically assume orders fill instantly at the signal price. In reality, there is a delay between decision and fill, and in that delay price moves. For a scalper with a tight target, even 200 milliseconds can matter.

The cost of latency depends on volatility. In a quiet tape, price barely moves in a fraction of a second. During active periods, which is when many scalping signals fire, price can move a pip or more in the delay.

To model it, add a delay to the simulated fills, using the observed distribution of real latency, not a single average. Apply the first available price after the delay, using the ask for buys and the bid for sells. Then compare the results with the zero-latency case.

The difference is often large, and it widens during volatile hours. A system that only works with zero latency is not tradable.

If the tester does not allow latency, post-process the signals with a custom script using tick data.

How much did performance drop after adding a realistic latency model to the backtest?
It’s Fairman :geek:
Recommended broker for automated trading & scalping IC Markets
Amanhasnoname
Posts: 2060
Joined: Fri Oct 30, 2026 9:45 am

Re: Latency in the tester versus latency in reality

Post by Amanhasnoname »

The zero-latency backtest of my EURUSD one-minute fade looked almost too tidy: fifty-five percent winners and about thirty-eight hundredths of a pip expectancy over four months of ticks. I then replayed every signal with a delay drawn from my live order log, clustered between eighty and three hundred and twenty milliseconds and past seven hundred on a busy open. Fills used the first ask or bid after that wait, not the signal print.

Expectancy fell to nine hundredths of a pip and the win rate to fifty-one percent. During the quiet Asian hour the drop was only a few hundredths. In the first twenty minutes of London, where most of the signals fire, a third of the trades that had been winners on the instantaneous fill flipped sign because price had already walked a pip.

I will not take a scalp live unless it still shows at least fifteen hundredths of a pip after that delay model. If the tester cannot apply latency I run the signals through a small script on tick data, which is tedious but cheaper than finding the same gap with real money.
Post Reply