A signal must precede its return
Audit a daily backtest with a three-price timing example.
Put information on a timeline
Suppose the closing prices are 100, 110 and 121. A signal that observes the second close can compare 110 with 100. In our daily model, it can first act on the next return, from 110 to 121.
Letting that signal earn the earlier move from 100 to 110 gives the strategy information it did not have at the start of the trade. This is look-ahead bias.
Check a minimal example
With a one-period momentum lookback, there is no position during the first price change. After observing the second close, the model takes a long position for the third close. With zero costs, total strategy return is 10%, while buy and hold returns 21% over the complete example.
The warm-up is an explicit part of the model. It should not be filled using later observations. Chronological splitting also needs to preserve the past history required to construct the first held-out signal.
State the execution assumption
A one-bar lag is a teaching convention, not proof that the assumed transaction would be available at a real close. Research on actual data must specify timestamps, tradable prices, latency and instrument availability.
Practice lagged positions, inspect the cost calculation, then audit the project timing.