Free trial
Menu
Learn guide

Identify Future Data Leakage in Backtests

Look-ahead bias happens when a backtest uses information that would not have been available at the moment of the trade. The strategy appears to know the future, so the backtest looks better than any live result can be. It is one of the most common errors in backtesting, and it is usually caused by timing, not by bad intentions.

QuantPower Research · Updated 3 Nov 2026 · 4 min read

Key point
At every step, a backtest may only use data that existed before the order would have been sent. If a rule needs a candle's close, the trade can only happen after that candle has closed.

How look-ahead bias gets into a backtest

MistakeWhat goes wrongFix
Trading at the close of the signal candleThe signal needs the close, so the trade cannot also fill at that closeFill at the next candle's open, or later
Using the day's high, low or close in an intraday ruleThese values are known only after the closeUse only candles that have already closed
Using indicators that look forwardSome smoothing methods, such as a centred moving average, use later pricesUse indicators calculated from past values only
Using end-of-day data for intraday decisionsDaily IV, open interest or settlement prices are published after the closeUse intraday snapshots, or trade the next day
Using today's lot sizes or expiry rules on old dataContract rules change over timeUse the rules in force on each date
Using revised dataCorporate actions and index changes are applied laterUse 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.

Chart of an opening range breakout in which the 9:15 to 9:30 high is known only at 9:30, with the biased and correct signals marked (illustration)

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

  1. Read the trade log. For each trade, confirm that every input was known before the entry time.
  2. 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.
  3. 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.
  4. 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.
  • [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)
Examples are for illustration only. Backtested results do not guarantee future results. Trading involves substantial risk.