Why does my EA backtest beautifully but lose money live?
Updated August 27, 2026
Short answer
Usually it's costs and execution before it's anything clever. The MT4 tester charges you one fixed spread, no commission and zero slippage, and it never requotes you, so a strategy that makes 2 pips a trade can be net positive in the tester and net negative on a real account without a single line of logic being wrong. Work through it in cost order first, then tick model, then look-ahead, then over-optimisation. Doubling the spread in the tester takes ten seconds and settles the question more often than not.
Start with what the tester never charged you
Boring, and it’s the answer more often than anything else here. The MT4 Strategy Tester has a Spread box, and whatever’s in it is the spread for the whole test. Every bar, every hour, every news release. Real EURUSD spread might be a fraction of a pip at 10am London, several pips at the New York rollover, and briefly enormous after a number lands. If your EA trades near the close or around news, the tester handed it a discount it won’t get live.
Commission is worse because there’s no field for it. MT4’s tester doesn’t apply one. On a raw spread account at $7 per round turn per lot, that’s roughly 0.7 of a pip on a standard EURUSD lot, absent from the report entirely. Swap has the same shape: the tester reads it from the connected server’s symbol properties, and on a stripped down offline setup those can be zero.
Spread understated by a pip, commission missing, swap missing. If the average winner is 6 pips, that’s a third of the edge gone.
Test it: re-run with the spread set to two or three times what you used. If the strategy dies at 3 pips on EURUSD it was never a strategy. If it survives, keep going down the list.
Then slippage and requotes, which MT4 doesn’t model at all
The tester fills you at the price you asked for. Always. No queue, no rejection, no partial fill, no gap through your stop. A stop at 1.0850 comes out at exactly 1.0850 in the tester and somewhere below it on a Sunday gap. Tight stops plus a high trade count is the combination this ruins.
MT5 gives you a knob at least. Its Strategy Tester has a Delays setting with Zero latency and Random delay among the choices, and running the same EA both ways shows how much of the result depends on getting the price you asked for. MT4 has no equivalent, so the spread test above is the crude substitute.
Now the tick model
Anything with a stop or a target has intrabar events, so how the tester built its ticks is load-bearing.
MT4’s Model dropdown gives Every tick, Control points and Open prices only. Every tick does not mean real ticks. MT4 invented those ticks by interpolating inside each M1 bar, and there’s no reason the path it invented matches the one the market took. When your stop and your target sit inside the same M1 bar, the tester picks the winner by rule, not by history.
MT5 has an honest version called Every tick based on real ticks, pulling actual tick history from the broker’s server. Read MetaQuotes’ own caveat though: where real ticks are missing, the tester falls back to simulating them exactly as in Every tick mode.
Test it: run the identical EA in each model, same period, same settings. An EA that only acts on bar close, with nothing resting inside a bar, should give nearly the same result three times. Wild swings mean the result is a story about interpolation. Markedly better on Open prices only means it’s leaning on coarse fills.
Getting real tick data into MT4 is its own job, walked through on the 99% modelling quality page.
Look-ahead, which is quieter than people expect
Two usual sources for the EA seeing something in the test it couldn’t have seen live at that moment.
Indicators that finalise late. ZigZag is the famous one: its last leg redraws as new bars arrive, so its history looks decisive and its live behaviour wobbles. If your EA reads a buffer from an indicator you didn’t write, check the value at shift 0 is the same once the next bar prints.
The other is treating a bar as closed when it isn’t. Code reading Close[0] is reading a price that’s still moving.
// signal off the last CLOSED bar, act on the current one
double prevClose = Close[1];
double prevMA = iMA(NULL, 0, 20, 0, MODE_EMA, PRICE_CLOSE, 1);
// shift 1, not 0. shift 0 is still forming and will change under you.
Test it: run in Visual mode and watch fifty entries. Fills landing suspiciously close to bar extremes, over and over, are the tell.
Over-optimisation, without the maths
You don’t need a formal framework for the obvious cases, just to know whether your result is a peak or a plateau.
Nudge the parameter that matters most. Period 14 was great. What do 12, 13, 15 and 16 do? All roughly fine means you found a region where the idea works. 14 wonderful with 13 and 15 losing means you fitted one number to one stretch of history. Works on EURUSD H1 and nowhere else is a coincidence with a name.
Then split the data. Optimise on the first two thirds, run the untouched final third once with those settings, and stop. MT5’s tester has a Forward option that does the split for you. The hard rule is you look at the out of sample result once. Look, adjust, re-run, and it isn’t out of sample any more. Be honest about the selection you already did, too: forty EAs tried and one that backtested well is forty experiments and the luckiest kept.
The data, the period and the account
Broker M1 history is cleaned and backfilled and it isn’t the same as anyone else’s. Bad ticks removed, gaps patched, weekend boundaries drifting with server time zone. Two brokers can give visibly different results for the same EA on the same dates. The period matters more than the data quality though. A carry strategy tested across 2015 to 2019 is trading a rate environment, a breakout tested through 2020 is trading one event, and if the result comes from a stretch that no longer resembles now, the test isn’t wrong, it just isn’t about now.
Then the account. Demo servers are usually a price feed with nothing behind them, so they fill instantly and never requote, which is why an EA behaves for a month on demo and changes character on day one live. It’s also why “verified on demo” is close to meaningless (more on that here).
And then the one that isn’t broken
Martingale and grid EAs backtest gorgeously because their equity curve is a long smooth rise then one vertical drop. Recover every loss by adding size and almost all closed trades are winners. The risk lives in the open positions, not the closed ones, and the summary line doesn’t foreground it. If your EA opens a second position in the same direction when the first goes against it, you don’t have a backtest problem, and the live account is just now reaching the part the backtest didn’t. Look at maximum floating drawdown rather than closed trade drawdown, and at the worst single losing sequence rather than the average.
If you’ve been through all of it
Run it at the smallest size your broker allows, live, for a month, then compare that month against the backtest over the same dates trade by trade. Not summary against summary. Where the two lists first diverge names the item on this page you’re dealing with, usually inside a dozen trades.