Look-ahead bias happens when a backtest uses information that nobody had on the date of the trade. The strategy then appears to know the future, so its results look better than any real investor could have achieved.
Common sources
| Source | What goes wrong |
|---|---|
| Reporting dates | Using a quarter's profit as of the quarter-end date when the result was announced weeks later |
| Restated data | Using financials as later corrected, not as first reported |
| Index membership | Using today's index constituents for past dates |
| Full-sample fitting | Estimating a parameter, scaler or regime model on all the data and applying it to the past |
| Same-day prices | Trading at a closing price that was used to compute the signal |
A worked example
A company's quarter ends on 30 September and it announces its results on 12 November. A backtest that assigns the profit to 30 September lets the strategy buy on 1 October on information that was published six weeks later. In India, listed companies must publish quarterly results within 45 days of the quarter end (60 days for the final quarter), so the gap is often a month or more. The dates here are illustrative.
How to prevent it
- Use point-in-time data that records when each figure became known.
- Add a delay between a signal and the trade, for example by trading at the next day's price.
- Fit every model only on data before the date it is applied. See walk-forward testing and out-of-sample testing.
- Be suspicious of results that look too good, and check for leakage first.
Look-ahead bias is closely related to survivorship bias and to overfitting, and all three can occur together.
Frequently asked questions
What is look-ahead bias?
It is the use of information in a historical test that would not have been available at the time of the decision, which makes results look better than they could have been.
What is an example of look-ahead bias?
Using a company's quarterly profit from the quarter-end date, although the figure was announced weeks later.
How is look-ahead bias different from survivorship bias?
Look-ahead bias uses information from the future. Survivorship bias leaves out companies that failed. Both flatter results, in different ways.
How do you detect look-ahead bias?
Check that every input has a timestamp no later than the trade date, test with a delay between signal and trade, and treat unusually strong results as a reason to look for leakage.