← Back to Blog Trading Education

Why Your Backtest Lied: The Gap Between Strategy Tester and Live Fills

<h2>The Most Expensive Lesson in Automated Trading</h2>

<p>You build a strategy. You run it in the MT5 Strategy Tester over two years of data. The equity curve climbs at a beautiful angle, the drawdown is shallow, the profit factor is over 2. You put it on a live account, or worse, on a funded challenge account, and within three weeks it is down and behaving nothing like the report.</p>

<p>Nothing broke. The tester was never lying to you deliberately — it was answering a slightly different question than the one you thought you asked. The tester tells you how a strategy would have performed under a simplified model of order execution. Live trading tells you how it performs under a real broker. The distance between those two things is where most automated strategies quietly die.</p>

<h2>Filling Modes: The Silent Failure</h2>

<p>This is the one that produces the most confusing symptom, because the strategy does not lose money — it simply does not trade at all, or trades intermittently, and you cannot see why.</p>

<p>MT5 supports several order filling policies. Fill or Kill requires the entire volume to be filled immediately at the requested price or the order is cancelled outright. Immediate or Cancel fills whatever volume is available and cancels the rest. Return keeps the remainder of the order live. The Strategy Tester is permissive about all of this. Live brokers are not, and different brokers accept different policies on different symbol types.</p>

<p>The result is an EA that backtests perfectly and then, on a live account, throws unsupported filling mode errors on every entry attempt. If your EA hardcodes a single filling policy, it is broker-specific whether you intended that or not. The fix is to query what the symbol actually supports and select accordingly, with a fallback chain rather than a single assumption.</p>

<h2>Spread: Modelled as a Constant, Lived as a Variable</h2>

<p>Most backtests run on a fixed spread, or on the average spread embedded in the historical data. Real spreads are not constant. They widen at the session rollover, they widen sharply around high-impact news, and on gold they can multiply several times over during volatile periods.</p>

<p>For a strategy holding positions for hours, this barely matters. For a scalper targeting eight to fifteen points, it is the entire edge. A strategy whose average win is 10 points and whose backtest assumed a 2 point spread will behave completely differently when the live spread averages 4 and spikes to 20 at the exact moments the strategy likes to trade — because volatility is what triggers the entry in the first place.</p>

<p>The test that matters: rerun the backtest with the spread doubled. If the strategy stops being profitable, you do not have a strategy, you have a spread-sensitive artifact.</p>

<h2>Slippage and the Assumption of Perfect Entry</h2>

<p>The tester generally assumes you receive the price you asked for. Live, your market order is filled at the best available price when it reaches the server, which after network latency and broker processing may be several points away — and systematically worse, not randomly worse, because price is usually moving in the direction that triggered your signal.</p>

<p>Stop losses are affected the same way and it is worse there, because a stop is triggered precisely when the market is moving fast against you. A backtest that shows a maximum drawdown of 6% built on the assumption of exact stop fills can easily produce 8% or more live. On a challenge account with an 8% limit, that difference is the whole account.</p>

<h2>Tick Data Quality</h2>

<p>Broker-supplied historical data is frequently thin, especially further back. Gaps get interpolated. If you test in a mode that models bars rather than real ticks, the tester has to invent what happened inside each bar, and its invention is smooth and orderly in a way real price action is not.</p>

<p>This matters enormously for any strategy where the sequence of events within a single bar determines the outcome — anything where the stop and the target could both plausibly be hit in the same candle. Under bar modelling the tester picks one. Live, the market picks, and it does not pick in your favour as often as the tester does.</p>

<h2>Look-Ahead Bias in Your Own Code</h2>

<p>The most damaging errors are the ones that are not the tester's fault at all. Reading an indicator value from the current, still-forming bar produces information that will not exist at that moment in live trading. Referencing the close of a candle before it has closed is the classic version. A strategy with look-ahead bias does not merely overstate its performance — it can look near-flawless, which is exactly why the equity curve should make you suspicious rather than pleased.</p>

<p>The rule of thumb worth internalising: if the backtest looks too good, assume a data leak and go looking for it before you assume you have found an edge. Verify by shifting every indicator read back by one bar and rerunning. If performance collapses, you found it.</p>

<h2>Costs the Tester Never Charged You</h2>

<p>Commission is often left at zero in testing. Swap on positions held overnight accumulates quietly and is asymmetric — one direction usually costs more than the other, and on some instruments one direction pays. A strategy holding trades for days can have its entire theoretical edge consumed by swap alone without a single losing trade.</p>

<h2>How to Actually Close the Gap</h2>

<p>Rerun with real tick data rather than bar modelling. Double the spread and confirm the strategy survives. Add realistic commission and swap. Shift indicator reads back one bar to rule out look-ahead. Then — and this is the step almost everyone skips — run it on a demo account attached to the same broker and server you intend to trade live, for long enough to accumulate a meaningful number of trades, and compare the demo results against the backtest over the identical period.</p>

<p>If the two diverge, the backtest is the one that is wrong. Fix the model, not the expectation.</p>

<p>A strategy that survives all of that is not guaranteed to make money. But it will at least be failing for honest reasons, which is the only kind of failure you can learn from.</p>

<h2>You Might Also Like</h2>

<ul>

<li><a href="/blog/post/how-are-risk-management-practices-applied-to-ml-ai-based-automated-trading-syste-cc9cf497">How are risk management practices applied to ML/AI-based automated trading systems?</a></li>

<li><a href="/blog/post/automate-stock-trading-97cd8d2b">Automate Stock Trading?</a></li>

</ul>

<p>Explore our <a href="https://alphabotpro.cloud/compare-prop-firms">prop firm comparison</a> and the <a href="https://alphabotpro.cloud/prop-firm-drawdown-calculator">drawdown calculator</a> before your next challenge.</p>

Want this handled automatically instead of managing it by hand?

Explore AlphaBotPro plans →
⚠️ Risk Disclaimer: Trading involves risk. Past performance does not guarantee future results. All trading strategies carry the potential for loss. Always trade responsibly and never risk more than you can afford to lose.

Ready to trade with an edge?

Let AlphaBot's proven algorithms handle the execution while you focus on the big picture.

Why Traders Use AlphaBotPro

🤖

Automated Execution

No emotions, no missed trades. Our system executes 24/7 with precision.

📡

Structured Signals

Clear entry, TP, and SL levels for every trade. No guesswork.

🛡️

Risk Control System

Built-in drawdown protection to safeguard your capital.

🏆

Prop Firm Ready

Designed to help you pass and maintain funded accounts.

Used by traders working toward funded accounts

Get AlphaBotPro