FlyTradr
Back to Blog
6 min read min read

Why Your Backtest Lies to You (And How to Stop It)

Super Admin
Why Your Backtest Lies to You (And How to Stop It)

Why Your Backtest Lies to You (And How to Stop It)

You ran a backtest. The results looked incredible — a Sharpe ratio above 2, consistent returns, and a drawdown so small you could barely see it on the chart.

You felt confident. You went live.

Then the market had other ideas.

If this sounds familiar, you're not alone. Almost every trader who gets into algo trading falls for the same trap: trusting a backtest that was misleading them the whole time.

This isn't about putting you off backtesting. Backtesting is one of the most powerful tools a trader has. But it's only powerful when you understand exactly where it can deceive you and how to catch it before it costs you real money.

Here are the three biggest ways backtests lie, and what to do about each.

The Problem With Backtests (And Why They're Still Worth Using)

A backtest is a simulation. You take a set of trading rules and run them against historical price data to see how they would have performed in the past.

Done well, it's invaluable. It lets you stress-test an idea before risking a single rupee. It shows you how a strategy behaves across market conditions. It gives you evidence to stand behind before deploying capital.

Done poorly — or misread — it gives you [italic] false confidence. Which is arguably worse than no confidence at all.

The three main culprits:

1. Lookahead bias

2. Overfitting (also called curve fitting)

3. Slippage and execution gaps

1. Lookahead Bias: When Your Backtest "Knew the Future"

Lookahead bias happens when your backtest accidentally uses information that wouldn't have been available at the moment a trade was made. In short — your strategy was cheating without you realising it.

Here's a simple example. Imagine your strategy buys when the closing price crosses above the 20-day moving average. Sounds fine. But if your backtest calculates that signal using the current candle's closing price and trades on that same candle, it's using data that didn't exist, yet when the trade should have been placed.

In real life, you only know a candle's close after it closes — which is when you'd act on the next candle. An off-by-one bar error like this can make a consistently losing strategy look like a winner.

How to catch it

• Always check that signals generated on the current bar execute on the next bar's open — not the same bar's close

• Be especially careful with strategies using intraday data, earnings releases, or corporate actions — common accidental lookahead sources

• In FlyTradr's Backtesting Lab, bar-close execution is the default: signals fire at candle close, orders fill at the next bar's open

We've written a full guide on this: How to Avoid Lookahead Bias in Backtests (with a checklist) /blog/avoid-lookahead-bias-backtests-checklist

Overfitting: When Your Strategy Only Works in the Past

Overfitting — sometimes called curve fitting — is what happens when a strategy is so perfectly tuned to historical data that it stops being a real strategy and becomes a description of the past.

Think of it this way. If you tested every combination of moving average lengths from 5-day to 200-day, you'd eventually find one that looks brilliant on that specific dataset. But you wouldn't have found a real edge. You'd have found a pattern that only existed in that particular slice of history.

The more parameters your strategy has, the more it can bend itself around whatever data you feed it. That's a problem.

Signs your strategy might be overfit

• The results are suspiciously clean — too few losses, almost no variance

• Performance drops sharply when you test a different time period

• The strategy uses oddly specific parameters (e.g. "buy when RSI is between 34.5 and 36.2")

• Changing any one parameter slightly causes results to collapse

How to catch it

The best protection against overfitting is out-of-sample testing. Split your historical data into two separate periods:

In-sample: Use this to develop and tune your strategy

Out-of-sample: Keep this completely separate and test your finalised strategy on it once only, as a final check

If the strategy holds up on out-of-sample data, you have a much stronger reason to trust it. If it falls apart, the backtest was telling you a story — not a truth.

And as a general rule: keep strategies simple. Fewer parameters mean less room to overfit.

Slippage and Execution Gaps: The Cost Nobody Tells You About

This is the one that catches most beginners off guard — because it's got nothing to do with your logic. It's about how real-world markets actually work.

Slippage is the difference between the price your backtest assumes you traded at, and the price you actually get when you go live. In a backtest, you typically assume you buy or sell at the exact price on the chart. In reality:

• You place a market order and get filled slightly worse than the last quoted price

• The bid-ask spread costs you on every entry and exit

• Your order is large enough to move the price before it fully fills

• There's a delay between your signal firing and the order reaching the exchange

These gaps look small on any individual trade. But across hundreds of trades, they compound. A strategy that looked profitable on paper can become breakeven — or worse — once real execution costs apply.

Transaction costs hit the same way. Brokerage fees, STT (Securities Transaction Tax) in India, GST on brokerage, exchange charges — all of them eat into returns a basic backtest simply ignores.

How to catch it

• Always backtest with a slippage buffer of at least 0.1%–0.2% per trade — more for illiquid instruments or high-frequency strategies

• Include your full brokerage fee structure — never assume zero-cost trading

• In FlyTradr's Backtesting Lab, you can set custom slippage and commission inputs before every run — spend a few minutes on this, it tells a far more honest story

For a deep dive on this: Backtesting Slippage: The #1 Reason Strategies Fail Live /blog/backtesting-slippage-why-strategies-fail-live

How FlyTradr Helps You Build Honest Backtests

All three problems share one thing: they're invisible unless you're looking for them. That's what makes them dangerous.

FlyTradr's Backtesting Lab (/platform/backtesting-lab) was built to remove the most common sources of self-deception:

Bar-close execution by default — no accidental lookahead from same-bar signal and fill

Customisable slippage and commission inputs — test against realistic assumptions, not optimistic ones

Multi-period testing — run across different market conditions to spot overfitting early

Plain-English results — Sharpe ratio, max drawdown, and win rate explained in context

The goal isn't to make your backtest look good. It's to make it tell you the truth.

Key Takeaways

Lookahead bias tricks your backtest into using future prices — check that signals and executions are correctly sequenced

Overfitting makes a strategy look perfect on paper by fitting too closely to history — always validate with out-of-sample data

Slippage and costs erode real-world returns — always run with realistic transaction assumptions baked in

• A great backtest isn't the one with the best numbers. It's the one that most honestly reflects what would have happened in real life.

Ready to run backtests you can actually trust? Try FlyTradr free => flytradr.com/pricing

Comments

Ask a question or leave feedback. Guests can post too.

Max 2000 characters.

No comments yet.

Read Next