How to Avoid Overfitting in TradingView Backtests
Separate parameter selection from later evaluation. Use a recorded chronological test plan, realistic costs and explicit resampling assumptions to assess a TradingView backtest.
Recognize Selection Risk Before Testing
A high historical profit factor is an observation about the selected sample. It does not show how many unsuccessful rules, parameter ranges, symbols or dates were tried before that result was chosen. Record those decisions alongside the final strategy so the selection process is visible.
First reconcile the simulation: symbol and feed, session, timeframe, available history, initial capital, sizing, commission, slippage and order-fill assumptions. A change in any of these can explain a result difference without proving overfitting. Standard OHLC bars and explicit execution settings make the comparison easier to inspect.
Inspect nearby parameter settings and other relevant periods. An isolated winning setting deserves investigation; a broad stable region is useful evidence but still does not establish future profitability. Keep the losing results in the record.
Define a Chronological Walk-Forward Protocol
Before looking at the evaluation results, specify training and test dates, whether the training window rolls or expands, parameter ranges, the selection objective and the retuning schedule. Select using the training period only, then apply that frozen configuration to the next period.
For example, a hypothetical protocol could train on January through December and test on the following January through March, then advance by three months. Those dates illustrate the procedure; they are not recommended window lengths or reported results. Choose windows for the strategy horizon and available independent observations before comparing outcomes.
Define indicator warm-up and treatment of positions crossing each boundary. Avoid letting information from a test trade leak into training labels or selection. A gap may be needed for overlapping observations; an arbitrary gap does not automatically remove every source of leakage.
Combine only the scheduled out-of-sample segments under a consistent capital convention. Report costs, exposure, trade count and dispersion across segments. If you redesign the protocol after inspecting them, they have become development data. Preserve a further untouched test or collect forward observations. No efficiency-ratio cutoff certifies the result.
Separate Trade-Order Stress from Bootstrap Resampling
A permutation reorders the same fixed cash trade outcomes. Their sum stays unchanged, although drawdown and time under water can change. Different terminal profits require another mechanism, such as replacement sampling, changed sizing or path-dependent trading constraints.
An independent bootstrap samples observed trades with replacement. It can produce different ending equity and drawdown, but assumes that those observations represent the process being modeled. Independent draws discard serial dependence; missing regimes and execution costs do not appear merely because more paths are generated.
Pineify Backtest Deep Report currently uses this replacement sampling approach for 1,000 paths and retains 50 individual paths. It analyzes imported cash P&L, not new market prices or altered strategy rules. A percentage of profitable paths is conditional on that sample and model, not a probability that the selected strategy has a genuine edge.
Review the simulation methods and calculation limitsKeep a Reproducible Validation Record
- Save the exact source version, inputs, feed and execution settings for every run.
- Write down parameter ranges and selection criteria before optimization; retain unsuccessful trials.
- Use a reasoned rule set. Neither a small parameter count nor 100 trades guarantees sufficient evidence.
- Evaluate profit, drawdown, exposure and uncertainty together. Sharpe and profit factor can also be overfitted.
- Freeze the validation schedule and report every later segment. Choose any retuning rule before its evaluation period.
- Keep paper or forward observations separate from development data and reconcile actual execution differences.
TradingView's strategy documentation explains selection bias, out-of-sample evaluation and their limits. The TimeSeriesSplit reference illustrates chronological splits and gaps; it is a general validation primitive, not a trading performance guarantee.
FAQ
Separate Optimization from Validation
Use the Strategy Optimizer to search exposed TradingView inputs. Plan chronological evaluation separately. Backtest Deep Report provides trade-list analysis and bootstrap scenarios; personal CSV import requires Advanced-or-higher access.
Review the Optimization Workflow