FREE FINANCIAL EDUCATION
Look-ahead bias
Identify future information hidden in features, labels and fills.
What you will learn
Prerequisites: Signal timestamps, bar construction and chronological simulation.
- Identify future information hidden in features, labels and fills.
- Shift feature availability to its actual confirmation time.
- Build a small timeline audit before running a large backtest.
Mechanism and decision rules
Look-ahead bias occurs when a decision uses information unavailable at its simulated time. It can enter through final bar values, revised economic data, future-confirmed pivots, current index constituents or unrealistic same-bar execution. The code may look syntactically correct while its timeline is impossible. Causality must be checked at the level of each input and each fill.
Write an availability timestamp for every feature. A centered five-bar average at bar t includes t+1 and t+2, so it cannot be used at t without delay. A swing high confirmed by two later bars becomes known only after those bars. Merely shifting the final trading signal may not repair leakage if model fitting or preprocessing has already used future data.
Worked example · synthetic data
Synthetic closes are 100, 102, 104, 106 and 108. The centered three-bar mean at the middle close 104 is (102 + 104 + 106)/3 = 104, but it uses the later 106 observation. A strategy at that middle timestamp cannot know this final centered value.
Another strategy buys at the daily open whenever that day’s close exceeds yesterday’s high. The condition is known only after the open has passed. It must either execute later or use a genuinely earlier forecast; booking the opening fill from the completed-close condition is look-ahead.
Failure modes and limits
Data vendors can revise history without preserving vintages. Machine-learning scalers fitted on the full dataset leak future distribution information. A conservative fill assumption cannot fix a noncausal feature. Timeline tests should include edge cases around session boundaries, releases and confirmation delays.
Practice case
A pivot low at bar 10 is declared only after bars 11 and 12 have higher lows. At what earliest point may the confirmed-pivot feature be used? Can a strategy claim an entry at bar 10 because the chart later draws the pivot there?
Reveal the worked answer
It becomes available after bar 12’s confirming information is complete, subject to receipt timing. The plotted label may be located at bar 10, but that is not its availability time. An entry at bar 10 based on the later confirmation would leak two bars of future information.
Check your understanding
Sources and next steps
The lesson, calculations and synthetic cases are original educational material. References explain underlying contract or chart conventions; none validates the profitability of a trading rule. Actual contract specifications, settlement obligations and charges must be checked before trading.
Explore OHLCV data in the chart lab · Explore volume-at-price and TPO data · Practice library
