The MT5 tester can model delays, but many people run it with zero latency. That makes results look better than live.
Options:
Use real ticks if your broker provides them, for realistic spreads.
Set a delay in the tester settings, for example random delay, to simulate execution lag.
Add slippage in the EA code in test mode: shift the fill price by a set amount against the trade.
How to pick values: use your live fill data. If market orders slip on average 0.1 pips with a tail of 0.5 pips on news, model that.
A worked example of the effect: an EA making 0.5 pips per trade in testing, with 0.1 pips of slippage on entry and exit, makes 0.3 pips. With 200 trades a month on 1 lot, that's $400 less per month.
Run tests with and without slippage. If the strategy only works without, it's not ready for live.
The worked example is a good way to show how much the tester can flatter an EA. Losing 0.2 pips per round trip doesn't sound like much until it's 40% of the average trade, and for a lot of scalping EAs it's even more than that.
One thing to add is that slippage isn't symmetric in live trading, and a fixed adverse shift in the tester treats it as if it were. Market orders in fast conditions mostly slip against you, but limit orders don't slip at all, they either fill or they don't. So for an EA that uses limit entries, the more realistic model isn't slippage on entry but missed fills, especially on the trades that would have been best, where price touched the limit and immediately left.
Stops are another case worth modelling separately. A stop order becomes a market order once triggered, so it slips the way market orders do, often more because stops tend to trigger during fast moves. Applying extra slippage to stop-outs than to normal exits might be closer to reality.
The time-of-day aspect matters too. If live data shows that slippage is negligible during London but larger in the hour after the New York close, a single average figure will understate the cost for trades in the bad windows and overstate it for the rest. If the EA trades in several sessions, it's worth applying different values by hour.
The rule at the end is the right one. If the edge disappears with realistic execution, the problem isn't the tester settings, it's that the edge was never large enough to survive trading costs in the first place.