What Is Curve Fitting in Backtesting? How to Spot an Over-Optimised Strategy
Blog by Aliceblue News Desk
21 October 2026
12 minutes
Your backtest shows a 58% return, a high win rate, and barely any drawdown. You are ready to trade it live. Then the same strategy starts losing money in the market. One common reason is curve fitting in backtesting over optimisation.
Curve fitting happens when you adjust a trading strategy again and again until it fits past price data too closely. The strategy may look excellent in the backtest, but it may simply be repeating random moves from that historical period. This blog explains how to identify an over-optimised strategy and test it more carefully before using real money.
Curve fitting in backtesting means tuning a strategy so closely to old data that it captures random price movements instead of a repeatable trading idea. An over-optimised strategy often has too many rules, very few trades, unusual settings, and weak results on unseen data. Test it on fresh data, include trading costs, and check whether small changes in settings cause big changes in results.
Table of Contents
- What Is Curve Fitting in Backtesting?
- How Does Curve Fitting Happen?
- Practical Example With Numbers
- How to Spot an Over-Optimised Strategy
- Parameter Sensitivity: A Simple Test
- Advantages of Careful Backtesting
- Risks and Limitations
- Tips for Beginners
- Curve Fitting vs Fair Strategy Testing
- Common Mistakes to Avoid
- Who Should Use Backtesting?
- Quick Checklist Before Trusting a Backtest
- Conclusion
- Frequently Asked Questions
- Valid Sources
What Is Curve Fitting in Backtesting?
Curve fitting in backtesting is the process of changing a strategy’s rules until it produces the best possible result on historical data. The problem is that those rules may fit old price movements rather than a pattern that repeats in the future.
For example, you may start with a simple moving average crossover strategy on Nifty 50 stocks. After seeing the first result, you change the moving average periods, add an RSI filter, adjust the stop loss, and add a volume condition. Each change improves the past result a little. Eventually, the strategy looks perfect on paper, but it may have been shaped around a few lucky trades.
This is also called overfitting. Overfitting means the strategy has learned details specific to the test period instead of a broader, repeatable market behaviour.
Backtesting is still useful. It helps you apply fixed entry, exit, and risk rules to historical data before risking capital. The issue is not backtesting itself. The issue is changing the strategy until the past data gives you the answer you want. Alice Blue’s guide on backtesting also highlights the need to define rules, test them on historical data, and validate the result before trading.
How Does Curve Fitting Happen?
Curve fitting usually happens in small steps. A trader does not set out to create a weak strategy. The problem develops while trying to improve a backtest.
- Start with a basic idea. For example, buy a Nifty 50 stock when its 20-day moving average crosses above its 50-day moving average.
- Run the first backtest. Check profit, loss, number of trades, win rate, and maximum drawdown.
- Change one setting. You may try a 17-day moving average instead of 20 because it gives a better result in the past.
- Add a filter. You may add a rule such as buy only when RSI is above 55, or trade only when volume is above average.
- Keep refining after every result. Each new rule may improve the backtest slightly, so you keep adding conditions.
- Choose the best historical combination. The final strategy may have five or more settings, all selected because they worked well in that particular period.
- Assume the result will repeat. This is where the risk begins. The strategy may have memorised old market behaviour rather than learned a dependable trading edge.
A simple rule is to keep the number of adjustable settings low. The more settings you can change, the easier it becomes to fit the strategy to random historical noise. Strategies with a small number of core settings are generally easier to understand and validate.
Practical Example With Numbers
Suppose a trader is testing a swing trading strategy on Reliance Industries. The trader uses daily charts from 2019 to 2024 and checks three versions.
Version | Rules | Trades | Win Rate | Total Return | Maximum Drawdown |
A | 20 and 50 EMA crossover with a 2% stop loss | 48 | 42% | 18% | 15% |
B | 17 and 43 EMA crossover with a 1.5% stop loss | 36 | 48% | 31% | 11% |
C | 17 and 43 EMA crossover, RSI above 55, volume filter, 1.2% stop loss, 4% profit target | 14 | 71% | 58% | 4% |
These numbers are illustrative. They are not actual Reliance Industries results and should not be treated as a forecast.
Version C looks best. It has the highest return, best win rate, and lowest drawdown. But it has only 14 trades and five adjustable conditions. That is a warning sign.
The trader then tests the same three strategies on fresh data from 2025 to 2026. This period was not used while building the strategies.
Version | Return in 2019 to 2024 | Return in 2025 to 2026 | What It Suggests |
A | 18% | 12% | Performance drops, but remains positive |
B | 31% | 9% | Some over-optimisation may be present |
C | 58% | Negative 6% | Strong signs of curve fitting |
Version C’s result falls sharply when tested on unseen data. That suggests its rules may have been selected to match the 2019 to 2024 period rather than a repeatable market pattern.
This is why out-of-sample testing matters. It means testing the final strategy on data that was not used during optimisation. If the result collapses, the strategy may be over-optimised.
How to Spot an Over-Optimised Strategy
An over-optimised strategy usually leaves clues. Look for these signs before trusting a backtest.
- Too many rules. A strategy with many indicators, filters, and exceptions has more chances to fit random price movements.
- Unusual settings. A 17-day EMA paired with a 43-day EMA may work in a backtest, but such precise values can be a sign that the trader kept searching until something looked good.
- Very few trades. If the strategy made only 10 or 15 trades, the result may depend on a few outcomes. It does not give enough evidence.
- Almost no losing trades. Real trading strategies have losses. A near-perfect equity curve can be a warning sign.
- Strong past results but weak fresh data results. This is one of the clearest signs of curve fitting.
- Works on only one stock. If a strategy works only on Reliance but fails on other large-cap stocks, it may be fitted to that stock’s past behaviour.
- Works only in one market phase. A strategy tested only during a strong rally may fail during a correction or sideways market.
- Ignores trading costs. A backtest without brokerage, STT, GST, stamp duty, exchange charges, and slippage can overstate profit.
Parameter Sensitivity: A Simple Test
Parameter sensitivity means checking whether your strategy still works when you change its settings slightly.
Suppose your best backtest uses a 17-day EMA and a 43-day EMA. Do not stop there. Test nearby values:
- 16-day and 42-day EMA
- 18-day and 44-day EMA
- 19-day and 45-day EMA
- 20-day and 50-day EMA
If results remain broadly similar, the strategy may be more dependable. If profit jumps from 58% to a loss when you change 17 to 18, the strategy may be sitting on a lucky setting.
A dependable strategy usually shows a stable area of results around its settings, not one isolated peak. If a tiny change causes a major collapse, the edge may be fragile.
Advantages of Careful Backtesting
When used properly, backtesting helps you make better trading decisions.
- Tests an idea before risking money. You can see whether a strategy has a logical structure before deploying it.
- Shows possible drawdowns. A backtest can reveal losing streaks and the kind of fall in capital you may need to tolerate.
- Reduces emotional decisions. Fixed rules for entry, exit, stop loss, and position size can reduce impulsive trading.
- Helps compare strategies. You can compare a trend-following strategy with a breakout or mean reversion approach using the same assumptions.
- Supports systematic trading. Traders using algo systems can test code, rules, and execution assumptions before automation.
Risks and Limitations
- False confidence. A strong backtest can encourage a trader to take bigger positions than the strategy can handle.
- Past patterns may not repeat. Volatility, liquidity, market participation, and news flow change over time.
- Costs can erase profit. For equity delivery trades, STT applies at 0.1% on both buy and sell sides. For equity intraday trades, STT applies at 0.025% on the sell side.
- Other charges also matter. NSE’s cash market transaction charge is 0.00297% of traded value, SEBI charges ₹10 per crore of turnover, and stamp duty applies on the buy side.
- Execution differences. A backtest may assume you get the exact closing price. In live trading, your order may fill at a different price, especially in less liquid stocks.
- Survivorship bias. If you test only companies that are successful today, you may ignore stocks that were removed from an index or declined sharply.
- Look-ahead bias. This happens when a backtest uses information that would not have been available at the time of the trade.
- Behavioural risk. A trader may override stop losses, change rules after losses, or abandon the strategy during a normal losing streak.
Tips for Beginners
- Begin with one or two rules. A simple moving average crossover with a stop loss is easier to test and understand than a strategy with six filters.
- Keep some data aside. Use one period to build the strategy and a later period to test it. Do not look at the fresh data while optimising.
- Use walk-forward testing. Optimise on one period, test on the next period, then move forward in time and repeat. This checks whether the strategy remains useful as market conditions change.
- Include all costs. Add brokerage, STT, exchange charges, SEBI fees, stamp duty, GST where applicable, and a realistic slippage estimate.
- Check enough trades. A strategy with too few trades does not provide enough evidence.
- Test different market conditions. Check rising, falling, and sideways markets, not only a bull run.
- Avoid fine-tuning after seeing results. If you keep changing rules after every weak result, you may be curve fitting again.
- Start small. Use paper trading or a small position size first, because live execution can differ from a backtest.
Curve Fitting vs Fair Strategy Testing
Parameter | Curve Fitted Strategy | Fairly Tested Strategy |
Number of rules | Many filters and special conditions | Few clear, logical rules |
Settings | Unusual values chosen for best past result | Reasonable values based on the trading idea |
Trade count | Often very low | Enough trades across periods |
Past data result | Extremely high or nearly perfect | Good, but realistic |
Fresh data result | Falls sharply | Remains broadly consistent |
Parameter changes | Small changes cause large result changes | Nearby settings give broadly similar results |
Market coverage | One stock, one period, or one trend | Multiple stocks and market phases |
Costs | Ignored or underestimated | Brokerage, taxes, charges, and slippage included |
A good strategy does not need the highest backtest return. It needs logical rules, enough trades, realistic costs, and acceptable performance on unseen data.
Common Mistakes to Avoid
- Optimising until the backtest looks perfect. This is the main cause of curve fitting. Stop once the strategy has a logical structure and acceptable risk metrics.
- Using the same data to build and validate. Keep a separate out-of-sample period for final testing.
- Ignoring brokerage and taxes. A strategy that looks profitable before costs may lose money after them.
- Testing only bullish periods. Indian markets move through rallies, corrections, and sideways phases. A strategy should be checked across these conditions.
- Using too little historical data. A few months may not capture different market environments.
- Adding indicators without a reason. Every rule should have a purpose, such as trend confirmation, risk control, or filtering poor trades.
- Deploying immediately after a good backtest. Validate the strategy on fresh data and consider paper trading before committing meaningful capital.
Who Should Use Backtesting?
Backtesting and optimisation are most useful for:
- Systematic traders who follow fixed rules.
- Algo traders who need to test code and strategy logic before automation.
- Swing traders testing moving averages, breakouts, or trend-following systems.
- Active intraday traders who must account for costs, liquidity, and slippage carefully.
It may be less suitable for complete beginners who have not yet learned position sizing, stop losses, drawdown, or trading costs. A new trader should understand these basics before relying heavily on backtested results.
Quick Checklist Before Trusting a Backtest
Ask these questions before using a strategy with real money:
- Does the strategy have more than four or five adjustable settings?
- Does it have fewer than 30 to 50 trades?
- Are the settings unusually specific, such as a 17-day EMA and a 43-day EMA?
- Did you test it on data it has never seen?
- Does performance collapse when you change one setting slightly?
- Did you include brokerage, STT, GST, stamp duty, exchange charges, and slippage?
- Does it work in rising, falling, and sideways markets?
- Does it work on more than one stock or index?
If several answers are no, or you are not sure, treat the backtest result with caution.
Conclusion
Curve fitting in backtesting over-optimisation is a major reason why a strategy can look excellent historically but perform poorly in live trading. Keep the rules simple, test on unseen data, include real trading costs, and check whether nearby settings produce similar results.
A good trading strategy should make sense before you look at its profit number. If the only reason you like it is that its backtest looks perfect, treat that as a warning sign, not proof that it will work in the future.
Frequently Asked Questions
Curve fitting is when a trading strategy is adjusted too closely to historical data. It may match past price movements very well but fail when applied to new market conditions.
An over-optimised strategy has too many settings or rules chosen mainly because they produced the best historical result. This can make the backtest look better than the strategy’s real-world potential.
Look for too many indicators, unusual settings, very few trades, unrealistic returns, and a large drop in performance during out-of-sample testing. A nearly perfect equity curve is also a warning sign.
Out-of-sample testing means testing your final strategy on historical data that was not used while building or optimising it. If performance drops sharply, the strategy may be over-optimised.
Parameter sensitivity checks whether your strategy still works when you change a setting slightly. If moving a moving average from 17 days to 18 days causes a major fall in profit, the strategy may be curve-fitted.

Blog by Aliceblue News Desk



