Look-ahead bias
Look-ahead bias means using information that was not available at the moment of the decision. The classic case is a rule that uses the close of a candle while pretending to enter at its open, or an indicator computed with data from after the signal. The backtest then looks far better than anything that could have been traded.
The remedy is to evaluate decisions only on closed candles and to enter at a price that was really available after the signal.
Overfitting
Overfitting happens when you adjust the parameters of a strategy until the past looks good. If you test enough combinations of periods, thresholds and filters, some of them will look excellent by pure luck, and they will fail on new data. The more freedom you give yourself, the more likely you are to find a lucky one.
A strategy with few parameters and a simple reason to work is less exposed than one with many tuned values. A result that disappears when you change a parameter slightly is a warning sign.
Keep data you never touched
The most reliable defence is to split the history in time. Tune the strategy on the first part, check it on a second part, and look at the last part only once, at the end. If the result holds on data that played no role in the choices you made, it means something. If it collapses, the strategy was fitted to the past.
The strategy lab in ATLAS separates the history chronologically into a training, a validation and a test period, by default 60, 20 and 20 percent. Shuffling the data randomly would leak the future into the past, so the split always follows time.
Costs that backtests forget
A test without spreads, commissions and slippage describes a market that does not exist. The effect is the largest for strategies that trade often or use small stops. Always run the test with realistic costs, or at least know by how much they would reduce the result.
Compare with a benchmark
A strategy that earned 30 percent on an instrument that rose 40 percent has not added anything. Compare every result with simply holding the instrument over the same period and with the same costs. In the strategy lab each idea is ranked by its gap to that benchmark, and an idea that sits below it is shown with its negative gap.
Enough trades, and data you can trust
A handful of trades proves nothing, and the guide on sample size shows how wide the uncertainty is. Historical data can also contain gaps or wrong prices, so it is worth checking the quality of the data before trusting a result.
Markets change
Even a well-built backtest describes the past. Market conditions shift, and a strategy can stop working. A backtest reduces the risk of trading something that never worked. It does not remove the risk of trading something that no longer works.
Frequently asked questions
What is the difference between a backtest and a forward test?
A backtest replays a strategy on past data. A forward test runs it on new data as it arrives, without changing the rules. A forward test is slower but cannot be fitted to the past.
How can I tell if a backtest is overfitted?
Check whether the result holds on a period that was not used to choose the parameters, whether it survives small changes to those parameters, and whether it beats a simple benchmark.
See it in ATLAS
Strategy Lab
Describe a strategy in plain words or paste a Pine Script; ATLAS turns it into rules and measures it.
Signal Statistics
Buy or sell: which strategy works best, on which timeframe and on which market.
Strategy Store
Strategies published by the community, measured by the ATLAS engine with raw results.
Terms used in this guide
Backtest, Overfitting, Look-ahead bias, Out-of-sample test, Sample size, Slippage.
More guides
This guide explains methods and arithmetic. It is not financial advice, and past results do not guarantee future ones. Read the risk disclosure.
