Guides

Why your backtest results differ from live trading

Why your backtest results differ from live trading

Almost every automated trader meets the same disappointment. The Strategy Tester draws a smooth equity curve, the profit factor looks healthy, and then the same EA on a live account behaves like a different program.

The gap is rarely caused by one dramatic bug. It is usually five or six small differences stacking up. This article goes through them in the order they matter, with what you can actually check in MetaTrader 5.

Contents

  1. Spread: the difference that quietly eats scalpers
  2. Commission and swap are often missing
  3. Slippage and requotes do not exist in the tester
  4. Modelling mode decides how honest the test is
  5. History quality
  6. Broker rules the tester relaxes
  7. Look-ahead bias in your own code
  8. Over-optimisation: the most expensive mistake
  9. The human factor
  10. A checklist before you trust a backtest

1) Spread: the difference that quietly eats scalpers

Spread is the single most common reason a profitable backtest turns into a losing account.

In the Strategy Tester you choose the spread in the settings. If you pick Current, the tester uses the spread recorded at the moment the test starts, and then treats it as constant for the whole period. Your live account does not work that way. Spread widens at the session open, around news, at the daily rollover, and on thin symbols it can multiply several times over.

Real tick data carries its own recorded spreads, which is better, but still the spread your broker gave their tick feed, not necessarily yours.

How much it matters depends entirely on how long you hold:

Average trade target One extra point of spread
10 points (scalping) Devastating — can flip a profitable system to a losing one
50 points (intraday) Noticeable, a few percent of the result
500 points (swing) Almost irrelevant

What to do: run the same test at a deliberately pessimistic fixed spread — two or three times your broker's typical value. If the strategy only works at the minimum spread, it does not work.


2) Commission and swap are often missing

The tester takes commission and swap from the symbol specification your broker publishes. Two things go wrong here.

Commission is frequently not in the symbol settings at all, especially on raw-spread and ECN accounts. The tester then charges you nothing, while your live account charges per lot per side. On a strategy that trades often, this alone can be the whole difference.

Swap is in the specification, but it changes. Brokers update swap rates, and they are tripled on one weekday (usually Wednesday) to cover the weekend. A long-term test using today's swap rate against two years of history is a rough approximation at best.

You can see what the tester actually knows with a short script:

MQL5
void OnStart()
{
   string s = _Symbol;
   PrintFormat("%s  contract size: %.2f",  s, SymbolInfoDouble(s, SYMBOL_TRADE_CONTRACT_SIZE));
   PrintFormat("tick value: %.5f  tick size: %.5f",
               SymbolInfoDouble(s, SYMBOL_TRADE_TICK_VALUE),
               SymbolInfoDouble(s, SYMBOL_TRADE_TICK_SIZE));
   PrintFormat("swap long: %.2f  swap short: %.2f  mode: %d",
               SymbolInfoDouble(s, SYMBOL_SWAP_LONG),
               SymbolInfoDouble(s, SYMBOL_SWAP_SHORT),
               (int)SymbolInfoInteger(s, SYMBOL_SWAP_MODE));
   PrintFormat("stops level: %d  freeze level: %d  spread: %d (floating: %s)",
               (int)SymbolInfoInteger(s, SYMBOL_TRADE_STOPS_LEVEL),
               (int)SymbolInfoInteger(s, SYMBOL_TRADE_FREEZE_LEVEL),
               (int)SymbolInfoInteger(s, SYMBOL_SPREAD),
               SymbolInfoInteger(s, SYMBOL_SPREAD_FLOAT) ? "yes" : "no");
}

Run it once on a live chart and once inside the tester. If the numbers differ, you have found a source of the gap.

What to do: if commission is missing, subtract it yourself. A simple approach is to make the strategy's target larger than the real round-trip cost and test whether it still survives.


3) Slippage and requotes do not exist in the tester

This is the difference people underestimate most.

In the Strategy Tester, when your EA sends a market order it is filled at the price it asked for. There is no network latency, no broker delay, no requote, no partial fill, and no gap between the decision and the execution.

On a live account, all of those exist. The effect is not symmetrical either: slippage tends to be worse exactly when you need it least — at news releases, at the open, and when a stop loss is hit in a fast move.

What to do: do not try to model slippage precisely; you cannot. Instead, build in margin. If a strategy nets 3 points per trade in the tester, it will not survive contact with a live account.


4) Modelling mode decides how honest the test is

MetaTrader 5 offers several modes, and the difference between them is large:

Mode What it does Use it for
Every tick based on real ticks Uses the broker's recorded tick history The final, serious test
Every tick Generates ticks from M1 bars using an algorithm A reasonable middle ground
1 minute OHLC Only four prices per minute Quick iteration while developing
Open prices only One price per bar Only for strategies that act strictly on bar open
Math calculations No trading at all Optimising a calculation, not a strategy

The trap: a strategy tested on Open prices only that places stop losses inside the bar will produce results that are simply fiction. If your logic looks at price during a bar, you must test on ticks.

⚠️ Real tick history is only as good as what your broker stored. Some brokers provide years of it, some provide a few months, some provide almost nothing. Check the Journal tab of the tester — it reports what history it actually downloaded and used.


5) History quality

MetaTrader builds its test history from the M1 data your broker supplies. That data can have gaps, spikes from bad ticks, or be missing entirely for older periods, in which case the terminal fills in from a lower timeframe.

A single bad tick can produce a trade that never could have happened, and if that trade is a large winner, it flatters the whole result.

What to do: look at the equity curve for one or two enormous trades. If removing the best three trades destroys the result, the strategy was never really profitable — it caught noise.


6) Broker rules the tester relaxes

Several live constraints are applied loosely or not at all:

  • Stops level — the minimum distance for a stop loss or take profit from the current price. Place a stop closer than this on a live account and the order is rejected.
  • Freeze level — how close to the price an order can no longer be modified.
  • Maximum volume and step — different per symbol and sometimes per account.
  • Trading session hours — some symbols are closed when the tester thinks they are open.
  • Margin and stop-out — the tester uses the settings it has, which may not match your live leverage.

Your EA should check these at runtime rather than assume them. The script in section 2 prints the relevant values.


7) Look-ahead bias in your own code

This one is a genuine bug, and it is easy to write by accident.

The classic form is reading the current, unfinished bar as if it were complete. In the tester the current bar's high and low are already whatever the modelled tick sequence produced; live, they are still forming. An indicator that uses iHigh(_Symbol, PERIOD_CURRENT, 0) in a condition is often quietly looking at information it would not have had.

The same applies to repainting indicators — anything that redraws past signals, such as a ZigZag. Backtested against its final, settled values, it looks prophetic.

What to do: work with closed bars — index 1 and higher — unless you deliberately need intrabar behaviour and understand it. A useful sanity check is to compare a tester run against a forward run on a demo account over the same period; large divergence points at look-ahead.


8) Over-optimisation: the most expensive mistake

You run the optimiser over 4,000 combinations, take the best one, and it shows a magnificent curve. That result is close to meaningless on its own. With enough parameters and enough attempts, something will fit any history — including its noise.

Warning signs:

  • Six or more optimised inputs
  • The best result is dramatically better than its neighbours. A robust setting sits in a broad plateau, not on a spike.
  • Small changes to the date range change the result completely

What to do: use forward testing. The tester's forward period holds back part of the history, optimises on the first part and verifies on the second. If forward results collapse, you fitted noise. Then test on a period you never optimised on at all.


9) The human factor

If you also trade manually, there is one more gap: the tester does not hesitate, does not move a stop loss "just this once", does not revenge trade after a loss, and does not skip a valid signal because the last two lost.

This is the hardest gap to measure, and for discretionary traders it is often larger than all the technical ones combined. The only real way to see it is to practise the strategy under replay conditions and compare what you actually did with what the rules said.

That is exactly what a manual trade panel inside the Strategy Tester is for — it is why I built Rhino Backtest Manager: the same interface, the same risk-based position sizing, on historical data.


10) A checklist before you trust a backtest

  • Tested on real ticks, not generated ones
  • Spread set to a pessimistic value, not the current one
  • Commission accounted for, even if the symbol settings omit it
  • The result survives removing the three best trades
  • Conditions use closed bars, or intrabar behaviour is deliberate
  • No repainting indicator in the entry logic
  • Five or fewer optimised parameters
  • The chosen settings sit in a plateau, not on a spike
  • Forward test passed
  • Verified on a date range never used for optimisation
  • Average target is several times the round-trip cost
  • Finally: run on a demo account for a few weeks and compare

The honest summary

A backtest cannot tell you a strategy will make money. What it can do is tell you a strategy is not worth trading — and that is genuinely valuable, because it saves real money.

Treat a good backtest as permission to run a demo, not permission to go live.

⚠️ Nothing here is financial advice. Trading carries substantial risk, and past results — tested or real — do not guarantee future performance.