Curve fitting in trading refers to the practice of adjusting a strategy's rules and parameters until they closely match historical price patterns. While some degree of parameter optimization is necessary, excessive curve fitting produces a strategy that describes the specific noise of the training data rather than capturing generalizable market patterns. The result is a backtest that looks excellent but a live strategy that fails.
How curve fitting happens
Curve fitting typically occurs through iterative optimization. A trader runs a backtest, observes the results, tweaks a parameter, runs again, and repeats until the equity curve looks smooth and the metrics are impressive. Each iteration adjusts the strategy to better fit the historical data, but with each adjustment, the strategy may be learning noise rather than signal.
The risk increases with the number of parameters being tuned. A strategy with two parameters (for example, a fast and slow moving average length) has limited capacity to overfit. A strategy with fifteen parameters (multiple indicators, thresholds, filters, and timing rules) can be sculpted to match almost any historical pattern. The more complex the strategy, the more likely that its impressive backtest is an artifact of curve fitting rather than evidence of a genuine edge.
Signs of curve fitting
Several warning signs suggest a strategy may be curve-fitted. Parameters that are highly specific (like a 17-day lookback rather than a round number) may have been discovered by exhaustive search rather than theoretical reasoning. Performance that degrades rapidly when parameters change slightly indicates the strategy sits on a narrow, fragile optimum. An extremely smooth equity curve with unrealistically high Sharpe ratios should raise suspicion.
The most definitive test is out-of-sample performance. If a strategy's performance drops dramatically on data it was not trained on, curve fitting is the most likely explanation. Walk-forward optimization formalizes this test by repeatedly optimizing on one period and testing on the next.
Avoiding curve fitting
Use as few parameters as possible. Each additional parameter increases the risk of fitting noise. Prefer parameters with theoretical justification over data-mined values. A 200-day moving average has decades of documented use, while a 173-day moving average was probably found by optimization.
Test parameter robustness by checking whether nearby parameter values produce similar results. If a lookback of 20 days works well but 19 and 21 do not, the result at 20 is likely noise. A robust parameter should show gradual performance changes across a range of values.
Reserve out-of-sample data for final validation and do not go back to adjust the strategy after seeing OOS results. This discipline prevents the subtle form of curve fitting that occurs when a trader repeatedly "peeks" at out-of-sample data and unconsciously adjusts their strategy to fit it.
Practical example
A trader optimizes a mean reversion strategy with parameters for lookback period, entry threshold, exit threshold, stop-loss distance, and position sizing factor. After testing thousands of parameter combinations, the best set produces a Sharpe ratio of 3.2 on three years of data. On the subsequent year of unseen data, the Sharpe ratio drops to 0.4. The high in-sample performance was an artifact of fitting five parameters to a relatively short dataset rather than evidence of a genuine trading edge.
How Tektii helps
Tektii supports walk-forward optimization and out-of-sample testing workflows that help traders detect and avoid curve fitting. The platform's version tree feature allows traders to track how parameter changes affect performance across different data periods, making it easy to identify fragile optimizations. By encouraging systematic validation rather than ad-hoc parameter tuning, Tektii helps traders build strategies grounded in robust patterns rather than historical coincidences.