QQ 201, 2 min read
Look-ahead bias
After this lesson you can
- Recognise four sources of look-ahead bias
- Apply the truncation test
- Apply the one-bar delay test
Look-ahead bias is when a simulated decision uses information from after the moment the decision was made. The result looks excellent and cannot be traded.
How it happens
Trading on the close you used to decide. A rule says: if today's close is above the average, buy at today's close. You only know the close once the bar has finished, and by then that price is gone. The honest fill is the next bar's open.
Indicators that peek. A centred moving average, or a high and low computed over a window that includes future bars, leaks the future into every signal.
Data that was revised. Economic figures are often corrected weeks later. A history containing the corrected value shows something nobody saw on the day.
Survivors only. Testing on today's list of stocks leaves out every company that failed. The history looks better than it was.
How to catch it
One good test is to cut the data short. Run the strategy on the first 60% of the history, then on 75%, then on all of it. Trades that happened early should be identical in every run. If cutting off the future changes a past trade, that trade was using the future.
Another is to delay every fill by one bar. A real edge usually survives. An edge that disappears was depending on a price it could not have had.
The terminal runs both as integrity checks. See Validation, check by check.
Key points
- A decision made on a close cannot be filled at that close
- Cutting off the future must not change the past
- Survivorship and revised data are look-ahead too
Check your understanding
A rule decides using today's closing price. What is the earliest honest fill?
You rerun a backtest on only the first 60% of the data and an early trade changes. What does that show?
Further reading
- Lopez de Prado, M. (2018). Advances in Financial Machine Learning. Wiley.
- Brown, S. J., Goetzmann, W., Ibbotson, R. G. and Ross, S. A. (1992). "Survivorship Bias in Performance Studies." Review of Financial Studies 5(4).