# How to Avoid Curve Fitting When Backtesting

> Curve fitting is the biggest risk in backtesting. Learn what it is, how to spot it, and how to design your backtest to produce genuinely predictive results.

**URL:** https://traderjournal.app/backtesting/how-to-avoid-curve-fitting-when-backtesting

---


# How to Avoid Curve Fitting When Backtesting

Curve fitting (also called over-optimization) is when you tweak your strategy rules until they fit past data perfectly — but the strategy falls apart on new data because the "edge" was noise, not signal.

## What Curve Fitting Looks Like

You backtest a strategy and get 55% win rate. You add a rule: "only trade if RSI is below 40." Now you have 65% win rate. You add another: "only trade on Tuesdays and Thursdays." Now 72%.

Each rule looks like an improvement in the backtest — but each extra rule makes the strategy increasingly fit to random patterns in your specific historical dataset rather than to a real market edge.

## Signs You Are Curve Fitting

1. **Too many rules:** A strategy that needs 5+ filters to be profitable is probably overfit
2. **Perfect backtest equity curve:** Real strategies have rough patches — suspiciously smooth results are a warning sign
3. **Works only on a specific date range:** If the strategy works beautifully from 2023–2025 but fails before or after, it is fit to that period
4. **Results collapse immediately on new data:** Forward test of even 50 trades shows significantly worse numbers than backtest

## How to Test for Curve Fitting

### Out-of-Sample Testing
Split your historical data: backtest on 70%, validate on the remaining 30% that you never touched. If the 30% performs similarly to the 70%, the strategy is likely genuine.

### Walk-Forward Analysis
Backtest on months 1–6, test on month 7. Then backtest on months 2–7, test on month 8. Repeat. If each walk-forward period shows positive results, the strategy has real generalizability.

## Rules to Keep Your Backtest Honest

1. **Define all rules before starting** — write them down before you look at the data
2. **Do not add rules to fix individual losing trades** — losing trades are normal
3. **Test at least 2 years of data** — longer periods reduce the risk of period-specific bias
4. **Compare to paper trade results** — a real-time sample should roughly match the backtest

## Journaling As Protection Against Curve Fitting

Log your strategy rules at the start of the backtest — date-stamped in a note. This prevents unconsciously revising what your rules "were" after seeing results. The journal is your accountability document.

## Summary

The goal of backtesting is not to find a strategy that worked on past data. It is to find a strategy that has a reason to work in the future. Keeping rules simple, testing out-of-sample, and documenting your rules before you start are the three most important protections against curve fitting.