Why your EA works in the backtest but not live (and how to prove it)

"Tester and real account completely different." That line turns up in EA job posts all the time.

The backtest looked clean. Live, the EA opens trades at odd times, skips trades it should take, or does nothing. The usual developer reply is "the market is different live". That is half true.

There are two kinds of difference:

  1. Market differences. Spread, slippage, liquidity and execution speed. Real, measurable, and not bugs.
  2. Code differences. The EA decides differently live because of how it was written. These are bugs, and they can be fixed.

The job is to separate the two with evidence. Below are eight causes we check first, a checklist, and how a written acceptance test catches them before you pay.

1. The tick model did not match reality

The MT5 Strategy Tester offers several modelling modes: "Every tick based on real ticks", "Every tick" (ticks generated from M1 bars), "1 minute OHLC" and "Open prices only".

Only the first replays your broker's recorded bid and ask prices. The others reconstruct price movement from bar data, so whenever your EA acts inside a bar (a stop and a target touched in the same bar, a trailing stop, a break-even move) the tester has to assume the order in which prices happened. Live, the market decides.

An EA tested on "Open prices only" sees one tick per bar, so any per-tick logic looks perfect there and behaves differently live.

What to do: run the final test on "Every tick based on real ticks" and state the mode in the test report.

2. Spread and slippage were assumed, not measured

Generated tick modes build prices from bar data, so the short spread spikes at rollover and around news are smoothed out or missing. A scalper with a tiny target can look excellent there and fail live with no bug in the code.

The tester also has a "Delays" setting that adds execution latency. Check what yours is set to.

What to do: test on real ticks, try a realistic delay, and log the spread at every entry. If the strategy only works with zero delay and the narrowest spread, that is a strategy finding, not a code defect.

3. Filling mode is set for someone else's broker

Every MT5 symbol allows specific order filling policies (ORDER_FILLING_FOK, ORDER_FILLING_IOC, ORDER_FILLING_RETURN), and they vary by broker and account type.

Code that hard-codes one policy works on the developer's broker and is rejected on yours with retcode 10030 (TRADE_RETCODE_INVALID_FILL). If the EA does not check the return code, it fails silently: no trade, no visible error.

What to do: read SYMBOL_FILLING_MODE for the symbol, or with the standard CTrade class call SetTypeFillingBySymbol(_Symbol) before sending orders. Log every failed request with its retcode.

4. Symbol names and contract specs are hard-coded

Your broker may call it EURUSD.raw, EURUSDm or EURUSD.pro. An EA that compares _Symbol == "EURUSD" or assumes a pip is always 0.0001 will skip trades or size them wrongly on another server. Contract sizes also differ between brokers, especially on gold, indices and crypto CFDs, so a lot size built on an assumed contract size can be far off.

What to do: use _Symbol, read digits, point, tick size, tick value and contract size from the symbol at runtime, and test on a symbol with a suffix.

5. Stops level and freeze level were ignored

Brokers set a minimum distance between price and a new stop or target (SYMBOL_TRADE_STOPS_LEVEL) and a distance inside which orders cannot be modified (SYMBOL_TRADE_FREEZE_LEVEL). Values differ by broker and symbol; the tester uses those of the broker it is connected to. On your account, a stop that is too close is rejected with retcode 10016 (TRADE_RETCODE_INVALID_STOPS), and so is a break-even move near the price.

What to do: check the stops level before every order and modification. Our sample EA skips the trade and logs why ([R4] SL distance ... below broker stops level ... - trade skipped).

6. Times were coded in the wrong time zone

Many MT5 brokers run their server clock at GMT+2 in winter and GMT+3 in summer, but not all of them. Your session filter may be in your local time, your news times in another zone, and your prop firm's day may reset at a fourth.

There is a tester trap too: according to the MQL5 documentation, TimeGMT() in the Strategy Tester always equals the simulated server time, so session times converted through TimeGMT() behave one way in the tester and another live.

What to do: keep every time in broker server time (TimeCurrent()), label it as server time in the inputs, and test the week when daylight saving changes if your rules depend on the clock.

7. The backtest could see the future

Look-ahead bias is any case where the EA uses information that was not available at the moment of the decision. Common forms:

In the tester, these signals often line up perfectly with turning points. Live, they appear late, move, or disappear.

What to do: evaluate signals on closed bars unless the spec says intrabar, and check a sample of historical signals bar by bar against what the EA could have known at that time.

8. Tick logic was tested as if it were bar logic

OnTick() runs on every incoming tick. A crossover checked on the forming bar can be true on one tick and false on the next: live, the EA enters, the cross disappears, and the bar-open backtest never showed that trade. Also, per the MQL5 documentation, ticks that arrive while OnTick() is still busy are not queued, so a slow EA sees fewer ticks live.

What to do: if the strategy is bar-based, run the signal logic once per new bar and read the last closed bar (index 1):

datetime g_lastBar = 0;

void OnTick()
  {
   datetime bar = iTime(_Symbol, PERIOD_H1, 0);
   if(bar == g_lastBar)
      return;              // signals are evaluated once per new bar
   g_lastBar = bar;
   // read indicator values at index 1 = last fully closed bar
  }

Trade management (stops, break-even, risk limits) can still run on every tick.

A checklist you can use today

Before you blame the market, check these:

How an acceptance test catches these problems

The checklist is condensed from the standard checks in our acceptance test checklist. The method: write down what the EA must do before anyone writes code, then prove each line.

1. A numbered spec. Every rule gets an ID (R1, R2 ... P1, P2) and a pass condition. "Enter on the next bar after the cross" is testable. "Enter when the trend is strong" is not.

2. Every rule writes its ID to the log. When the EA acts, or decides not to, it logs a line starting with the rule ID, so the video shows cause and effect.

Here are lines from the Experts log of our sample EA, tested on EURUSD from 1 July to 1 October 2026 on "Every tick based on real ticks" (4,513,250 ticks):

[R1] SELL opened 0.74 lots at 1.13855 SL=1.13989 TP=1.13586
[R1] EMA cross up but close is not above trend EMA - no buy
[R4] ATR=0.00090 SL distance=0.00134 (x1.50) TP distance=0.00269 (x2.00)
[R5] below min volume: calculated 0.0008 < min 0.01 ... trade skipped

The second and fourth lines matter as much as the first. A skipped trade with a written reason is the difference between "it doesn't trade" and "it didn't trade because rule R5 said so".

3. Standard checks on every EA. Filling mode, stops level, volume step, suffixes, restarts and server time are tested whether or not the client listed them.

4. Honest results. In that run, 12 of 13 acceptance tests passed in the Strategy Tester. The 13th, restart safety, needs a live demo chart and is done during the recording. Testing also found a cosmetic logging bug in our own EA (0.001% risk printed as "0.00%"), fixed in version 1.01. A test report should show what passed, what has not run yet, and what was found.

5. Backtest vs forward run, trade by trade. If you ask for it in the quote, we run the EA on demo, backtest the same days on real ticks, and compare every trade: time, direction, entry price, exit reason. Each difference is labelled market (spread, slippage) or code. Market differences are measured and explained. Code differences are fixed.

Our 30-day warranty follows the same line: if the code breaks a rule in the signed spec, including live-only bugs like filling mode, symbol suffixes or stops level, we fix it free.

What this does not prove

An acceptance test proves the EA follows your rules. It does not prove the rules make money, and nobody can honestly promise that.

Get your EA tested against your rules

Mudasir, the engineer behind AlgoTailor, has finished 680 jobs on MQL5, rated 4.9 from 620 client reviews (public MQL5 profile). Every new build starts with a numbered spec and ends with an acceptance video chaptered by rule, before final payment, with full source code delivered on final payment.

If you already have an EA that trades differently live, a Code Rescue starts with a diagnosis of the cause.

Send your rules. We reply within 24 hours, Monday to Saturday (PKT), with questions and a fixed quote. Send your rules on algotailor.com


Trading involves substantial risk. AlgoTailor builds software to the client's specification and does not provide trading or investment advice or guarantee trading results. AlgoTailor is not affiliated with MetaQuotes.

Related: MT4 & MT5 development · Why a ChatGPT-written EA does not trade

Send your rules. Rough notes are fine. We reply within 24 hours, Monday to Saturday (PKT), with questions, a numbered spec and a fixed quote.

Send your rules