glossary

Lookahead bias

The error that makes a worthless strategy look perfect: peeking at a price the bot could not have known. It hides in one index offset.

Lookahead bias is a backtesting error in which the strategy's decision at a given bar uses data from that bar or later bars that would not have been available at the moment the decision was made in live trading, for example the current bar's close, high or low, or an indicator computed with future values. It inflates backtest results and disappears in live trading.

Official Binance broker · Non-custodial · Live only when you confirm · Updated

01

Where it hides

Entering at the open of a bar using that bar's close; a breakout rule that compares to the current bar's high; indicators that are centred or recomputed over the whole series; data joined by date without the publication lag.

02

How OptAlgo checks

Before a backtest runs, the strategy is checked for reading future bars and for non-deterministic code. Fills happen at the next bar's prices, never the signal bar's. A strategy that fails the check does not run; the findings name the line.

03

Prefix invariance

A strategy with no lookahead gives the same signal for a bar whether the data ends at that bar or continues a year later. OptAlgo's tests use this property on features and strategies alike.

faq

Lookahead bias FAQ

My strategy enters on the close. Is that lookahead?

Entering at the close of the signal bar is, because the close is known only when the bar ends. OptAlgo fills at the next bar.

Can an indicator have lookahead?

Yes: any centred moving average, zig-zag, or indicator recomputed over the full series after new data arrives. Use causal indicators.

Check your strategy for lookahead, free.

Start free, no card

50 backtest units a month on the Free plan.