Look-ahead bias: when a backtest cheats without meaning to
Look-ahead bias means a backtest used information that was not yet available when the simulated decision was made. The result looks like skill but is really hindsight.
Common ways it happens
- Trading at the price you used to decide. A signal computed from today's closing price cannot also buy at today's close. Real orders are placed after the signal is known.
- Using data before it was published. Company financials are released weeks after the period ends, and later restated. A test that uses the final numbers as of the period end is using the future.
- Using today's index membership. Knowing which stocks later joined an index is information from the future. See survivorship bias.
- Normalising with the whole sample. Scaling a signal using the average of the entire history lets the future leak into every earlier date.
How to catch it
- Lag the signal. Decide on one bar, trade on the next. Make this a rule of the engine, not a habit.
- Store data as of each date. Keep what was known then, not only the cleaned final version.
- Write tripwire tests. A simple example: change all data after date T to garbage and re-run. Every decision made before T must be unchanged. If any decision moves, the engine is reading the future.
Why automated checks matter
Careful people still make this mistake, usually in a small, late edit. Tests that fail loudly protect against it far better than good intentions do. Our methodology builds these checks into the engine so that a run which looks at the future cannot complete.
This article is educational and is not investment advice.