A strategy that looks brilliant in a backtest and then bleeds money live is one of the most common experiences in algorithmic trading. It is rarely bad luck. Almost always, the backtest was measuring something slightly different from what the live account actually trades. This guide walks through the specific, fixable reasons that gap appears and a checklist you can run before putting real money behind any system, whether you coded it yourself or bought it.
The short answer
Backtests usually overstate live performance for five reasons: (1) the costs in the test are lower than real costs, (2) the fills in the test are better than real fills, (3) the test accidentally uses information that was not available at the time, (4) the strategy was tuned until it fit the past, and (5) the market regime changed. Each one is measurable, and most can be reduced.
1. Costs: spread, commission and swap are understated
Many backtests use a fixed spread, or the spread from the moment the test was run. Real spreads are variable. On XAU/USD a broker might quote 15–25 cents in the London and New York overlap, but spreads commonly widen several times over around the daily rollover (5:00 PM New York time), on Monday opens and in the seconds around high-impact releases like CPI or Non-Farm Payrolls.
For a strategy with a small average profit per trade, this matters enormously. If a scalping system averages a $0.60 gain per ounce per trade before costs and the real average spread plus commission is $0.35, more than half the edge is gone. Swap (overnight financing) is the other cost that is often switched off in tests; it can turn a profitable swing system on gold into a losing one when it holds long positions for weeks.
Fix: test with variable, historical spreads where your platform supports it (MT5’s “Every tick based on real ticks” mode uses the broker’s recorded ticks and spreads), add commission per lot, enable swap, and then re-run with costs inflated by 50% as a stress test. If the strategy only works at the cheapest possible cost assumption, it does not really work.
2. Fills: slippage, latency and partial execution
A backtest typically assumes a stop or market order fills at exactly the trigger price. Live, a stop order becomes a market order and fills at the next available price. In fast markets that can be dollars away on gold. Limit orders have the opposite problem: the test may assume a fill whenever price touches your level, while in reality price can touch it without your order being filled.
Fix: add a fixed slippage assumption to every stop and market fill, and only count limit fills when price trades through the level, not just to it. Compare a few weeks of demo or small live fills against the test for the same signals and measure the average difference. That number is your real slippage.
3. Look-ahead bias: using the future by accident
This is the most damaging error because it can make a worthless strategy look exceptional. Common versions:
- Signals calculated on a bar’s close but entered at that same bar’s open or at a price inside the bar.
- Indicators that repaint, such as ZigZag or some fractal and pivot tools, whose past values change once later bars form.
- Using daily highs and lows in a rule during the same day they are being formed.
- Higher-timeframe data in multi-timeframe tests that “knows” the final value of a bar that has not closed yet.
Fix: make every signal act on the next bar’s open after the condition is confirmed on a closed bar. If the results collapse when you shift entries by one bar, the original result was almost certainly look-ahead.
4. Overfitting: the test learned the past, not the market
Every parameter you optimize (MA lengths, stop distance, session filter, RSI threshold) gives the strategy more freedom to fit historical noise. Run thousands of combinations and the best one will look superb by chance alone. Signs of overfitting include:
- Performance that is excellent at one parameter value and poor at its neighbours (for example, great at a 23-period MA but bad at 21 and 25).
- Many rules and filters relative to the number of trades.
- Fewer than roughly 100–200 trades in the test, which makes the win rate and profit factor statistically shaky.
- A smooth equity curve in-sample and a flat or falling one on data the strategy never saw.
Fix: hold back out-of-sample data you never touch while developing, use walk-forward testing (optimize on one window, test on the next, roll forward), prefer parameter values that sit in a broad, stable “plateau” of good results, and keep the rule count small.
5. Regime change
Gold traded in a very different way in a low-volatility, range-bound year than in a year with rapid rate changes or a sharp trend. A breakout system tested mostly on trending years will struggle in a choppy one, and a mean-reversion system does the reverse. This is not a flaw you can fully remove, but you can measure it: split the backtest by year and by volatility level (for example, by daily ATR) and check whether profits come from one short period.
6. Psychology and execution discipline
A backtest takes every signal. A human trading a system manually often skips trades after a losing streak, closes winners early or moves stops. Missing just a handful of the biggest winners can wipe out a year’s edge for strategies with a low win rate and large average winners. Automated execution, or a signal service you follow mechanically, helps here, but only if you actually take every signal.
A practical pre-live checklist
- Costs: variable spread, commission, swap and slippage included; still profitable with costs +50%?
- Entries shifted to the next bar open; no repainting indicators.
- At least 100–200 trades, across several years and market conditions.
- Out-of-sample or walk-forward results reasonably close to in-sample results.
- Neighbouring parameter values also profitable.
- Maximum drawdown and longest losing streak known, and you can tolerate 1.5–2× both.
- Small live or demo run whose fills you compare against the test before scaling up.
Frequently asked questions
How much worse should I expect live results to be than a backtest?
There is no fixed rule, but many experienced system traders assume live returns will be meaningfully lower and drawdowns larger than in testing. The more trades a strategy makes and the smaller its average profit per trade, the larger the gap from costs and slippage tends to be.
Is MT5’s strategy tester more accurate than MT4’s?
MT5 can test using real recorded ticks with variable spreads and is multi-threaded, so it is generally more realistic than MT4’s modelled ticks. It is still only as good as the broker’s historical tick data and your cost assumptions.
What is walk-forward testing?
You optimize the strategy on one block of history, test it unchanged on the next block, then roll both windows forward and repeat. The combined out-of-sample results are a more honest estimate than a single optimized backtest.
How many trades does a backtest need?
Generally at least 100, and ideally several hundred, spread across different years and volatility conditions. A test with 30 trades can show a 70% win rate purely by chance.
Can a demo account replace live testing?
Demo is a useful step, but demo fills are often better than live fills, especially around news. A small live account gives the most realistic picture of slippage.
Trading forex and gold carries a high level of risk. Past performance, including backtested performance, does not guarantee future results. See our risk disclaimer.




