Home/Glossary/Lookahead bias
Statistics & testing

What is lookahead bias?

Lookahead bias is a testing error in which a backtest uses information that was not yet available at the moment of the simulated decision, making results look better than anything a trader could have achieved.

It creeps in quietly: using a day’s close to decide a trade at that day’s open, measuring a chart pattern from a swing low that was only confirmed several bars later, or using indicator values computed with later data. In pattern statistics the classic case is measuring from the pattern’s last point. CryptoPatterns.ai measures each pattern from the bar where it became visible (for swing-based patterns, after the swing is confirmed five bars later) and checked the rule by re-running detection on data cut off at each entry bar.

Why it matters

Lookahead bias produces the most convincing fake results in trading, because the logic of the strategy looks sound and only the timing is wrong. A few bars of hindsight on a swing low can turn a coin-flip pattern into one that appears to catch every bottom.

Example

Say a double bottom’s second low prints at $3,000 on ETH, and swing lows are confirmed after five higher bars, by which time price is $3,180. A backtest that enters at $3,000 books a 6% head start on every winner that no trader could have had. Entered at $3,180, the same occurrences may show no edge at all.

Common mistakes

  • Using the close of a bar to trade at that bar’s open or during it.
  • Using indicators that redraw after the fact, such as zigzag lines or centred moving averages.
  • Testing past years on today’s list of coins. That related error, survivorship bias, leaves out the coins that collapsed or were delisted.

Questions

How do I check a backtest for lookahead bias?

Re-run the signal on data cut off at each decision point and confirm it would have fired with only the bars available then. If the results change, the original test used the future.

Is survivorship bias the same thing?

It is related. Survivorship bias tests only assets that still exist today, which leaves out the failures and flatters results. Both errors use knowledge a trader at the time did not have.

Related terms

Part of the crypto trading glossary. Definitions are educational, not financial advice.