Backtesting
Every profitablebacktest deservesthis question first
Did it read anything it could not have known at the time? Look-ahead is not an exotic failure — it is the default outcome of writing a backtest carelessly, and it produces exactly the results you were hoping for.
Three ways it gets in
The forming candle
The commonest one, and it bit us. An indicator computed on a bar that has not closed uses a value that will change before the bar ends — often crossing your threshold and crossing back. The strategy appears to enter at prices that were never available at a decision point. Closed candles are the default here now rather than an option, because "remember to exclude the open bar" is a rule that gets forgotten exactly once.
The feature computed over the whole series
Normalising by a mean, scaling by a maximum, or filling a gap using values from after the gap — each one leaks the future into the past. It is invisible in the code and devastating in the result, because the leak is strongest at exactly the points a strategy trades.
The restated history
Some venues correct or adjust bars after the fact. A backtest run today on adjusted data models decisions you could not have made with the data as it was. Data that can be restated is re-read rather than trusted as immutable — a cache that never revisits a bar it already has will hold the wrong numbers indefinitely.
What a strategy has to survive here
A truncation audit
A strategy written as code is run against a truncated series and compared against the full one. If a score for a given bar changes when data after that bar is removed, the strategy read the future — and it is refused rather than reported with a caveat. The audit exists because you cannot review your way to this property: the leak is usually one call, in a library, in a line that looks like normalisation.
One computation, everywhere
The series a screen reads, the series a backtest reads and the series the assistant reasons over are the same computed series, with the same warm-up. If they were computed separately they would drift, and a strategy would pass a test against numbers the live system does not produce.
Warm-up treated as a first-class thing
A smoothed indicator produces a number long before that number is stable. Cutting the warm-up short does not cause an error; it causes a slightly wrong series that a backtest happily trades. Ours are warmed up deliberately — one regime label flipped its answer on eleven per cent of bars until its warm-up was doubled.
Questions about look-ahead
How do I know my own strategy is clean?
Run it and read the audit. A strategy that scores bars is checked by truncation before it is accepted, so the answer is produced by the platform rather than by your confidence.
Is intrabar data available at all?
Yes, for the things where it is legitimate. What is not legitimate is treating the current, unfinished bar’s indicator value as a decision input, and that is the case the default now closes.
Does this apply to machine-learning models too?
More so. A model’s feature matrix is exactly where a whole-series transform hides, and a model that has seen the future scores beautifully and trades terribly. The same discipline applies, plus a check that the model reproduces its own predictions through the live inference path.