StructureX

Home › Glossary

What is overfitting in trading?

In one line: Overfitting is when a trading strategy is shaped so closely to past data that it learns random noise, so it looks great in tests and does poorly on new data.

Trading glossary · Updated 2026-10-21

The idea

Picture a student who memorizes last year's test answers. They score 100% on last year's test. On a new test, they're lost.

An overfit strategy is that student. It "knows" the past perfectly and has learned nothing that carries forward.

A simple example

You test a moving average rule on one year of data. You try every length from 5 to 100.

Length 37 looks best: +40R over the year in testing. Length 35 is +5R. Length 40 is −8R.

That's a warning sign. If tiny changes flip the result, 37 probably just matched that year's random wiggles.

You run length 37 on the next year. It comes out around 0R. A math example, not a promise.

The warning signs

Why it matters

Overfitting is the main reason backtests look better than real trading. You think you have an edge. You have a memory of the past.

The fix is to test on data the strategy has never seen. See walk-forward testing and why backtests don't guarantee results.

A common mistake

Adding a new rule after every loss in your test. "Skip Mondays." "Skip if RSI is 63." Each rule removes a few losers from the past. Together they fit the past and nothing else. Keep rules few and simple. See how to backtest a trading strategy.

Hold back the most recent part of your data. Build on the rest. Test on the held-back part once, at the end.

Questions

How do I know if my strategy is overfit?

Test it on data it wasn't built on. If results drop sharply, or small setting changes flip them, it's likely overfit.

What is the difference between overfitting and curve fitting?

Curve fitting is the act of tuning settings to past data. Overfitting is the result when that tuning goes too far.

How many trades do I need to avoid overfitting?

More trades and fewer rules both help. Many traders want at least 100 trades per set of rules. See sample size.

Want the next step? We'll walk you through it.

Four free lessons by email, one every few days — each with a 10-minute exercise on a real chart.

Send Me the Free Lessons 4 short emails · No spam · Unsubscribe anytime

Or see the whole method, step by step:

See What’s Inside the Course Try everything free first. Decide when you're ready. · Open the free chart tool (works in the TradingView phone app)

One chart idea a day, in plain English. Follow along:

Follow on XFollow on TradingView