What it means
Overfitting is tuning a rule until it matches past data so closely that it fails on new data. Look-ahead bias is using information in a test that would not have been known at the time, such as a candle's close before it closed or a swing that was only confirmed later.
Related problems: data snooping (testing many ideas and keeping the best) and survivorship bias (testing only assets that still exist).
Why traders use it
Both make backtests look better than live results. The cure is to keep some data unseen until the rules are fixed, and to make the code only use closed candles and confirmed pivots.
Chart examples
Tuned on the past, tested on unseen data
How to identify it objectively
- 1Split data: in-sample for development, out-of-sample for one final test.
- 2Count how many variations you tried.
- 3Check every input is available at the decision time.
- 4Watch for performance that collapses on new data.
Bullish use
- 1A rule that performs similarly in and out of sample is more credible.
- 2Few parameters and simple rules overfit less.
Bearish use
- 1A smooth in-sample curve followed by an out-of-sample decline is the classic overfitting signature.
What confirms it
- Walk-forward results across several periods.
- Similar results on related markets.
What invalidates it
- Rules changed after seeing out-of-sample results.
- Indicators that repaint.
How a hypothetical setup is built
Entry
Fix every rule before the out-of-sample test.
Stop
Use only closed-candle data in the test.
Target
Report in-sample and out-of-sample results separately.
A hypothetical illustration of how the concept is turned into a plan, not a recommendation. Practise it on a paper account first.
Related concepts
- Risk Management & StatisticsExpectancy
- Risk Management & StatisticsProfit Factor
- Risk Management & StatisticsMaximum Drawdown
- Full guide on The TradeskillJournal, Replay and Backtesting
Historical testing
The diagram is schematic: a curve tuned on the first period and then run on unseen data. It shows the pattern to look for, not a result.
Limitations: when it fails
- Even out-of-sample tests can be overfitted if repeated many times.
- Markets change, so past robustness is not a guarantee.
- Small samples hide bias.
Knowledge check
Pick an answer to see the explanation. Nothing is saved.