Overfitting in a TradingView Strategy: 6 Tests to Detect It
A TradingView strategy is overfitted when its good result comes from fitting the past rather than from a regularity of the market: it collapses as soon as you move a parameter, change the period, or count the trials that went into finding it. The decisive test is a period set aside before any tuning and opened only once.
Updated 17 October 2026. Research on past data, not investment advice.
Why the Strategy Tester cannot see it
The Strategy Tester computes what the strategy would have done on the bars you looked at while tuning it. It does not know how many variants you tried before. Yet that number is what manufactures the mirage: the more variants you try on the same data, the further the best observed score drifts from the true expectation. That is not bad luck; it is a statistical property.
Lab measurement on pure noise (prices with no signal at all): an automatic research loop believes it is improving in 88 to 98% of sessions, and without counting trials its deflated Sharpe passes 95% in 64 to 86% of sessions. With trials counted: 0 to 1% (350 autoresearch sessions).
The 6 tests, from simplest to strictest
| Test | What you do | Sign of overfitting |
|---|---|---|
| 1. Neighbourhood | Move each parameter by one step | The result collapses at 19/52 while it shines at 20/50 |
| 2. Counted trials | Record every variant tried | Dozens of trials, only one shown |
| 3. Unseen period | Set aside the end of the history before any tuning | Gain in training, loss in test |
| 4. Walk-forward | Re-tune then test on several successive folds | One fold out of four wins |
| 5. Another market | Apply the rule unchanged to a neighbouring market | The rule only works on its original market |
| 6. Number of events | Count independent decisions | Fewer than 30 in the test period |
1. Parameter neighbourhood
A real rule tolerates being nudged. If 20/50 gives +80% and 19/52 gives −10%, the +80% describes that setting, not the market. In TradingView, turn each parameter into an input and sweep the neighbouring values; an "isolated peak" result surface is the warning sign.
2. Count the trials
Testing RSI 25, 28, 30 and 32 over 7, 14 and 21 periods is 12 trials presented as one. The Lab records each trial before the calculation and corrects the verdict with the deflated Sharpe ratio, computed on the real number of trials. Measured example: a sweep of 1,300 variants of a volatility breakout on BTC 4h, whose best setting made +2,606% over 8 years, fell to a deflated Sharpe of 3.9% once the 1,301 trials were declared (details).
3. The unseen period
The protocol has four steps: seal a slice of data before the search; search without touching it; open it once, on the champion; accept the verdict. Our GPU search shows it: +172.7% in training, −37% on the sealed slice (post-mortem). Step by step in TradingView: test a Pine strategy out of sample for free.
4. Walk-forward
Split the history into folds: tune on fold 1, test on fold 2, then move forward. The volatility breakout above beat buy-and-hold in only 1 walk-forward fold out of 4: verdict mirage.
5. Another market, unchanged
A strategy forged on one market and applied as-is to another is a hard test to game. Thousands of short strategies forged on the Bitcoin decline, then tested on ETH: about 2% beat buy-and-hold (cross-asset verdict).
6. Enough independent events
With too few decisions, even a real rule stays unjudgeable. The Lab's judge requires at least 30 independent events in the test period. Faber's 10-month rule produced only one over 2012-2026.
What overfitting is not
- It is not a TradingView bug. The calculation is exact; our Pine exports replayed in TradingView reproduce our trades to the cent (check).
- It is not only about complexity. A two-parameter rule can be overfitted if you tried a hundred pairs.
- A bad test result is not a failed test. It is the information the backtest was hiding.
Run the 6 tests on your strategy
- The free Lab for Windows: trials counted automatically, sealed period, walk-forward, deflated Sharpe, a "holds" or "mirage" verdict on your machine.
- Test your Pine strategy for free with the Quick Check.
- Check the trades in TradingView: the Lab's Pine export pastes into the editor. Open TradingView (partner link).
FAQ
How do I know if my Pine strategy is overfitted?
Set aside the end of the history before any tuning, tune on the start, then open the end once. If the gain disappears, the result came from tuning.
How much data should I keep for the test?
There is no single rule. The Lab seals the last 30% of the data by default; what matters is fixing the cut before looking at results.
Does TradingView Deep Backtesting prevent overfitting?
No. It computes on more history and over a chosen date range; it does not count your trials or seal a period.
Is optimising parameters forbidden?
No. Judging the strategy on the data used to optimise it is the problem.
Sources
- Strategy Arena: 350 sessions on noise (12 October 2026), 1,306 variants (13 October 2026), +172% then −37% (16 August 2026), shorts in a bear market (16 August 2026).
- Bailey and López de Prado, The Deflated Sharpe Ratio (2014), for the correction by number of trials.
Disclosure: Strategy Arena takes part in the TradingView partner program. If you create a new account through our links and then subscribe on the web, we may earn a commission at no extra cost to you. It changes no number and no verdict in this article.
Research on past data, not investment advice. Past results do not guarantee future results.
⚠️ Disclaimer — This article is for informational and educational purposes only. It does not constitute investment advice or a buy/sell recommendation. Past performance does not guarantee future results. Strategy Arena is an educational simulator with virtual capital. Always do your own research before making investment decisions.