Lookahead bias (data leakage)

Lookahead bias, also called data leakage, is the use of information in a backtest that would not have been available at the moment the simulated decision was made. It inflates results silently, because the rule appears to anticipate what it was in fact told, and it can enter through the data, the indicator, the level or the research process itself.

Senzoukria · Glossary · Updated September 2026


Where the future leaks in

Common entry points, from the obvious to the quiet
Entry pointExampleWhat it looks like in results
Bar timingDeciding on a bar's close but filling at that bar's openEntries that catch the move that formed the signal
LevelsMarking a session POC or value area from the whole session, then trading it intradayLevels that price respects suspiciously well
IndicatorsA centred moving average or a smoothing that uses later barsTurns identified before they happen
DataAdjusted contract series built with information from after the roll; survivorship in a symbol listSmooth series where the real path had a jump
Options contextUsing today's gamma profile to explain a past sessionA regime that fits every historical day
Research processChoosing the test period after inspecting resultsAn out-of-sample period that is not

Keeping it out

  • Decide on closed bars and enter at the next bar's open, or state a different convention explicitly and justify it.
  • Compute every level, profile and indicator from the bars available before the decision bar, and freeze it there.
  • Store the timestamp at which each input was known, including open-interest dates for options data, and refuse inputs whose timestamp is later than the decision.
  • Handle contract rolls by keeping the roll policy in the record and not carrying a level across expiries without addressing the price difference.
  • Fix the training and test boundaries before any parameter is examined.

Why it is hard to see

A leak does not produce an error; it produces a better number. The test runs, the curve rises and nothing flags the cause. The usual tell is a result that is too regular: entries at the bar that made the move, levels that hold too often, an out-of-sample curve that looks like the in-sample one. Reproducing the rule with only the information that a live process would have had is the check, and it often shortens the equity curve considerably.

In Senzoukria

The Automatic backtest engine makes decisions on closed bars and fills entries at the following bar's open, with exits modelled on bar prices and configured costs, which removes the most common bar-timing leak by construction. The walk-forward mode's hint states its own guard: parameters are chosen on the start of each slice and evaluated on the end, which took no part in the choice.

The research guides on this site keep the same rule for levels: a level discovered with the next day's profile introduces look-ahead, so a footprint or profile level used in a rule must be fixed with information available before the signal bar. A strategy that reads a session profile or a level should be checked to confirm that what it reads at each bar is the developing value, not the completed one; the engine's bar timing does not protect against a level computed with later data.

Common mistakes

  • Filling at the signal bar's close as if the order had been resting there.
  • Using a completed session's value area for entries inside that session.
  • Explaining a historical day with a present-day gamma profile.
  • Treating a walk-forward as leak-free while the slice boundaries were moved after seeing results.

This page in other languages

Frequently asked questions

Is lookahead bias the same as overfitting?
No, though both inflate a backtest. Overfitting tunes a rule to the accidents of one sample using information that was available at the time; lookahead uses information that was not available yet. A rule can be free of one and full of the other. Both are checked by asking what the process actually knew at each decision.
Does entering at the next bar's open remove lookahead?
It removes the bar-timing form of it, which is the most common. It does not protect against levels or indicators computed with later data, against adjusted series that used post-roll information, or against a research process that chose its test period after looking. Each entry point needs its own check.
Can options data leak into a futures backtest?
Yes. Open interest is published once a day after the close, so a gamma level built on today's open interest describes positions that were not observable during today's session. A historical test that reads such levels must use the snapshot that existed at the decision time, with its own timestamp, not the one that became available later.

Keep reading