{"slug":"look-ahead-bias","term":"Look-Ahead Bias","category":"Quant & Stats","definition":"Look-ahead bias is a backtest using information that was not available at the moment the decision was made — a candle's close before the candle finished, a revised data point, a level drawn with hindsight. It produces results that could never have been traded live, and it is the most common reason a beautiful backtest fails in production.","street":"If the rule knew where the candle closed before it closed, it is not a strategy, it is a time machine — and the exchange does not accept those.","depth":["The classic case: a rule that acts 'when RSI crosses 30' evaluated on the closed candle, then the entry priced at that candle's open — you traded before you knew. Or resolving a setup against a candle that was still forming. Or using the day's high in a rule that runs at the day's open. Our pattern backtests detect on closed candles and enter at the next open for exactly this reason, and the setups resolver never judges a forming candle for a stop.","How to catch it: for every rule, write down the timestamp at which each input was known and the timestamp at which the trade would have been placed; if any input's timestamp is later, the test is contaminated. Data revisions are subtler — a market-cap rank recomputed later is not the rank the rule would have seen. Paper-trade the rule forward for a month and compare; a large gap is the bias showing itself."],"live":{"label":"Pattern backtests: closed candles, entry at the next open","href":"/patterns"},"related":["backtest","overfitting","survivorship-bias","sample-size","candle-close-confirmation"]}