How look-ahead bias gets into a backtest
| Mistake | What goes wrong | Fix |
|---|---|---|
| Trading at the close of the signal candle | The signal needs the close, so the trade cannot also fill at that close | Fill at the next candle's open, or later |
| Using the day's high, low or close in an intraday rule | These values are known only after the close | Use only candles that have already closed |
| Using indicators that look forward | Some smoothing methods, such as a centred moving average, use later prices | Use indicators calculated from past values only |
| Using end-of-day data for intraday decisions | Daily IV, open interest or settlement prices are published after the close | Use intraday snapshots, or trade the next day |
| Using today's lot sizes or expiry rules on old data | Contract rules change over time | Use the rules in force on each date |
| Using revised data | Corporate actions and index changes are applied later | Use data as it stood on each date |
Example: an opening range breakout
An opening range breakout buys when Nifty futures trade above the high of the first 15 minutes, from 9:15 to 9:30.
- Correct: the opening range is known at 9:30. A breakout can only be acted on after that, and the order fills at the next available price.
- Biased: the code uses the high of the 9:15 to 9:30 window but checks for a breakout from 9:15 onwards. Early in the window, the strategy is trading against a high that has not happened yet.
The biased version catches moves it could never have caught live. The fix is a time check: no signal before 9:30.
Look-ahead bias in options backtests
Options data adds its own traps:
- Choosing strikes with end-of-day prices. A rule that sells the strike nearest ₹100 premium at 9:20 must use 9:20 prices, not the day's settlement price.
- Expiry dates. Bank Nifty had weekly expiries until November 2024, and NSE moved expiries to Tuesday from September 2025. A backtest must use the expiry calendar of each date. See our F&O expiry calendar.
- Lot sizes. Nifty's lot was 75 for most of 2025 and is 65 from the January 2026 series. Applying one lot size to the whole history misstates profit and margin.
- Implied volatility. IV calculated from the closing price cannot drive a morning entry.
How to check a backtest for it
- Read the trade log. For each trade, confirm that every input was known before the entry time.
- Shift the entries. Delay every entry by one candle. A small change in results is normal; a collapse suggests the strategy depended on information it could not have had.
- Look for results that are too good. Very high win rates, tiny drawdowns or entries at the exact low of the day are warning signs.
- Paper trade. Paper trading uses live prices as they arrive, so look-ahead bias cannot occur. Compare its results with the backtest over the same weeks.
Related biases
- [Overfitting](/avoiding-overfitting): settings fitted to the noise of one period. Walk-forward testing tests for it.
- Survivorship bias: testing only stocks that exist today, which leaves out companies that were delisted or dropped from an index.
- Ignoring costs: leaving out brokerage, STT and slippage. Our STT tax calculator shows what each trade costs.
Avoiding it in QuantPower
Whatever tool you use, including QuantPower's strategy builder and backtesting, check your rules for the timing mistakes above, especially entries timed to the close of the signal candle. Then run the strategy in paper trading before going live.
Start your free trial
Connect your broker, build a strategy and test it on paper before a single live order goes out.
Frequently asked questions
What is look-ahead bias in simple words?
A backtest that uses information from the future. For example, a rule that buys at 10:00 using that day's closing price.
Why does look-ahead bias make results look better?
Because the strategy appears to know what will happen next, it avoids losing trades and enters at better prices than it could in real time.
How is look-ahead bias different from overfitting?
Look-ahead bias is a timing error in how data is used. Overfitting is choosing settings that fit past noise. A backtest can have both.
Can paper trading have look-ahead bias?
No. Paper trading runs on live prices as they arrive, so the future is not available to it.
Sources
- SEBI, measures to strengthen the equity index derivatives framework, 1 October 2024, and circular on expiry days, 26 May 2025
- NSE, equity derivatives contract specifications, lot sizes and freeze quantities (nseindia.com)
- NSE, schedule of STT, exchange transaction charges, SEBI turnover fee and stamp duty; Finance Act, 2026 (STT rates from 1 April 2026)
