Look-ahead bias hides in bar-close logic
Posted: Fri Oct 30, 2026 8:22 am
Look-ahead bias hides in bar-close logic
A backtest uses the close of the current bar to decide an entry at the open of the same bar. This is impossible in reality, since the close is not known until the bar ends.
The error is easy to make. An indicator calculated on the close, a condition triggered by the high of the bar, and an entry at the bar's open produce flattering results.
For scalpers on short timeframes, the effect is large. Many trades depend on small moves within bars, and any knowledge of the bar's outcome gives a huge edge.
Checking for it means reading the code or the rules carefully. Every decision should use only data available at the moment of the decision. Entries should be placed at the open of the next bar, or on a tick within the bar using only prior ticks.
A result that looks too good is the usual hint. Equity curves with almost no drawdown are suspicious.
Has the logic been checked for any use of information that would not have been available at entry time?
A backtest uses the close of the current bar to decide an entry at the open of the same bar. This is impossible in reality, since the close is not known until the bar ends.
The error is easy to make. An indicator calculated on the close, a condition triggered by the high of the bar, and an entry at the bar's open produce flattering results.
For scalpers on short timeframes, the effect is large. Many trades depend on small moves within bars, and any knowledge of the bar's outcome gives a huge edge.
Checking for it means reading the code or the rules carefully. Every decision should use only data available at the moment of the decision. Entries should be placed at the open of the next bar, or on a tick within the bar using only prior ticks.
A result that looks too good is the usual hint. Equity curves with almost no drawdown are suspicious.
Has the logic been checked for any use of information that would not have been available at entry time?