Noon Barbari
S'inscrire
Tous les articles
analyse approfondiePublié ·Lecture de 8 min

Look-ahead bias: the silent backtest killer (with examples)

Look-ahead bias doesn't look like a bug — it just makes your backtest better. That's what makes it so dangerous. Here are the ways it sneaks in and how to catch it.

Sur cette page

Most backtest bugs make your results worse, so you notice them. Look-ahead bias does the opposite: it makes your results *better*, which is exactly why it's so dangerous. It is the act of letting a backtest use information it could not have had at the moment it traded — a peek at the future — and it quietly inflates every number it touches. The strategy looks brilliant in testing and falls apart live, because live, the future isn't available yet.

What it costs you

Two equity curves: a red 'with look-ahead bias' curve climbing far higher than an orange 'corrected' curve, with the impossible gap between them shaded.
The same strategy with and without a small look-ahead leak. The red curve is the fiction your backtest reports; the orange is what you could actually trade.

The chart shows the same strategy run two ways: once with a small future leak, once corrected. The red curve is the seductive fiction your backtest prints; the orange is the tradeable reality. Notice how *little* leakage it takes to produce a large, smooth, convincing outperformance — a tiny peek at the next bar compounds into an edge that looks like genius and is entirely unreachable.

The common ways it sneaks in

Look-ahead bias rarely arrives as an obvious "use tomorrow's price" line. It hides in subtle places:

  • **Acting on the same bar you signalled on.** Computing a signal from a candle's close and then filling the trade at that same close. Live, when the candle closes the moment to act at that price has passed — you fill on the *next* bar.
  • **Using a bar's high or low to decide an intraday entry.** You only know a candle's full range after it completes. A rule that "buys when price touches the day's low" is using information from the end of the day to trade its start.
  • **Whole-dataset normalisation.** Scaling a feature by the mean or standard deviation of the *entire* history leaks the future into every past bar. Any statistic a rule uses must be computed only from data available up to that point.
  • **Repainting indicators.** Some indicators revise their past values as new data arrives. Backtesting on their final, settled values uses numbers that didn't exist when the trade would have fired.
  • **Survivorship and restated data.** Testing on today's list of "top coins" leaks the knowledge of which survived; using restated or back-adjusted data imports corrections that weren't available in real time.
  • **Exiting at a price you only know in hindsight.** Closing "at the high of the move" or "just before the crash" is trivial in a backtest and impossible live. The exit has to trigger on a rule that fired in real time, not on a turning point you can only identify after it has happened.

How to catch it

The structural defence is a strict bar-close discipline: evaluate every rule on closed bars only, and fill on the next bar's open. An engine that enforces this by construction makes whole categories of look-ahead impossible.

Beyond that, two tests flush out leaks that survive:

  • **The smell test on results.** A suspiciously smooth, suspiciously high equity curve with a tiny drawdown is the classic signature of look-ahead. Real edges are bumpier. If a result looks too good, assume a leak until you've proven otherwise.
  • **[Walk-forward](/docs/walk-forward) and paper trading.** A leak that flatters the in-sample backtest usually collapses on out-of-sample data, because the future it was peeking at is now genuinely unknown. And [paper trading](/blog/paper-trading-explained) on live data is the ultimate filter — it is structurally impossible to look ahead in real time, so a strategy that was secretly leaking simply stops working.

The bottom line

Look-ahead bias is the most common reason a backtest and live trading diverge — and it's covered as one of the core leaks in why your live trading underperforms your backtest. The cure is discipline, not cleverness: trade only on information that existed at decision time, evaluate on bar close, validate out-of-sample, and treat any backtest that looks too perfect as guilty until proven innocent. Every Noon Barbari backtest runs on a strict next-bar execution model precisely so this whole class of self-deception is off the table by default.

Essaie-le sur tes propres données

Chaque concept ci-dessus est implémenté dans la plateforme. Backtest, walk-forward, paper trading, puis passage en live — même jeu de règles à chaque étape.

Lectures associées

Guides associés

Termes clés