An indicator that uses the current bar's close to generate a signal on that same bar is peeking at the future if the bar has not closed. In a backtest, where the bar is already complete, the signal appears at its best possible moment.
Live, the same indicator changes as the bar develops. The signal appears, disappears, and reappears, and the entry price is not what the historical chart suggests.
Look-ahead bias also appears in subtler forms: higher timeframe data that is only available after the higher bar closes, pivot levels calculated using the day's full range, or zigzag-type indicators that redraw.
A clean test is running the strategy forward in real time on demo, recording each signal when it appears, and comparing with what the backtest would have produced for the same period. Any difference points to a bias.
In code, the rule is using only information available at the moment of decision, with explicit shifts to the previous bar where needed.
Has a promising strategy ever turned out to rely on information that was not available at the time of entry?