How to Spot Look-Ahead Bias in a Backtest
Look-ahead bias occurs when a historical strategy uses information before it would have been available. A signal based on a closing price needs a fill timestamp consistent with how the order could actually have been placed.
Separate data time, signal time and fill time
For an earnings release published after the bell, record when the data was available to the strategy, not just the date printed on the report. For multi-timeframe rules, use completed bars or explicitly model which values were visible on the unclosed bar.
Run the same rules with a shorter data window
Pick a cutoff and run the rules once with data through that date, then again with the later data included. Compare entries and signals before the cutoff using the same settings. The final open position may be handled differently at the boundary, so focus first on decisions made before it.
Review what was in the universe at the time
A present-day list can miss assets that were removed or delisted. Preserve the historical membership when it matters, and record how you handled missing prices and splits. Before retesting, write down the data availability rule so it can be reproduced.