Test Your Strategy

Home / Blog / EA backtest vs live

Why your EA works in backtest but not live

The Strategy Tester report looked excellent. On a live or demo account the same Expert Advisor trades differently, more often, less often, or at worse prices. Almost always the cause is a gap between what the tester assumed and what your broker actually does. Here are the usual suspects in MetaTrader, and how to check each one.

1. The modelling mode was too generous

MetaTrader 5's Strategy Tester offers several ways to simulate price inside each bar: Every tick based on real ticks, Every tick (generated), 1 minute OHLC and Open prices only. The faster modes guess what happened inside the bar. For an EA with tight stops, trailing logic or intrabar entries, that guess decides the result — a bar that touched both the stop and the target gets resolved in whichever order the model assumes.

Check: re-run on "Every tick based on real ticks" with your own broker's history. If the profit shrinks sharply, the earlier report was describing the model, not the market.

2. The spread in the test wasn't your spread

A tester run with a fixed or "current" spread ignores what spreads do around the rollover, at session opens and during news — exactly when many EAs trade. A scalper making a few points per trade can be wiped out by spreads that widen for a few minutes a day.

Check: use real-tick data, which carries the recorded spread, and add a maximum-spread guard to the EA so it refuses to trade when the spread is abnormal.

3. Commission and swap were left out

Raw-spread and ECN accounts charge commission per lot. If the tester's symbol settings don't include it, every trade looks cheaper than it is. Swap matters for anything held overnight, and some instruments carry a triple swap on one day of the week.

Check: compare the tester's per-trade costs with a real trade from your account statement. They should match.

4. Server time and session filters don't line up

Broker server time is rarely your local time and often shifts with daylight saving. An EA told to trade "the London open" at a fixed hour can drift an hour out of place for part of the year, or trade a different session entirely on another broker. Strategies built around the Tokyo or New York open are especially sensitive.

Check: log the server time of each entry on demo and compare it with the session you intended. Session logic should account for the broker's offset explicitly rather than assume it.

5. Execution: slippage, requotes and rejected orders

The tester fills market orders instantly at the modelled price. Live orders can slip, be requoted or be rejected — most often in fast markets, which is when breakout EAs fire. Brokers also impose a stop level (minimum distance for stops and pending orders) and a freeze level (a zone near the price where orders can't be modified). An EA that ignores them gets error codes instead of trades.

Check: read the Experts and Journal tabs on demo. Error codes such as invalid stops or requotes point straight at the cause. A well-built EA checks return codes and retries or adjusts sensibly instead of silently giving up.

6. The EA forgets things when it restarts

In the tester, an EA runs once from start to finish. Live, the terminal restarts, the VPS reboots, you change a setting — and the EA's variables reset. An EA that counts "trades today" or tracks its own open positions in memory can open duplicates or break its own daily limits after a restart.

Check: restart the terminal mid-session on demo. A robust EA rebuilds its state from the open positions and account history, identified by its own magic number, every time it starts.

7. Something else is trading the account

A second EA, a manual trade or a copy-trading service on the same account can be mistaken for the EA's own positions if magic numbers and symbols aren't filtered carefully. The tester never has this problem, because nothing else runs there.

8. Symbol names and contract specs differ

Brokers name symbols differently (EURUSD, EURUSD.m, EURUSDpro) and set different contract sizes, tick values and minimum lot steps — gold is a frequent source of trouble. Hard-coded symbol names or assumed tick values produce wrong lot sizes or no trades at all.

Check: the EA should read contract size, tick value and volume step from the symbol itself, and round lots to the broker's step.

A sensible order to investigate

  1. Read the Journal and Experts logs for errors. Free, and often decisive.
  2. Re-run the backtest on real ticks with real costs from your own broker.
  3. Compare tester trades with demo trades for the same week, trade by trade.
  4. Restart the terminal mid-session and watch what the EA does.
  5. Only then question the strategy itself — the general causes are covered in why backtests don't match live results.

Most of these are build problems, not strategy problems, which is good news: they can be fixed without changing the idea.

Want an EA built to survive live trading?

Every EA we build handles real-tick testing, spread guards, broker time and restart-safe state as standard.

WhatsApp