Aug 11, 2025 • 13 min read
Optimizing TradingView Backtests: Performance, Settings, and Metrics
Backtests are only as good as their assumptions. Set realistic properties, avoid repaint, and focus on metrics that matter.
Strategy Properties that shape results
- Commission and slippage: set per-market norms (e.g., futures vs equities).
- Initial capital and order sizing: fixed size vs percent of equity.
- Pyramiding and concurrent entries: align with your actual execution plan.
Performance-oriented coding tips
- Reuse calculations; avoid heavy loops and redundant
request.security()
calls. - Compute higher-timeframe signals once, then reference.
- Plot only what you need on large datasets to keep charts responsive.
Metrics that actually help decisions
- Net profit, max drawdown, and profit factor are basics; add return/drawdown ratio.
- Expectancy and win/loss distribution—check for outlier dependence.
- Sensitivity analysis: vary key inputs and verify stability across symbols/timeframes.
Equity curve diagnostics
- Look for smoothness and absence of sudden cliffs; inspect periods around drawdown spikes.
- Compare long vs short contributions; ensure edge isn’t one-sided unless intentional.
- Check trade frequency and exposure; too few trades inflate uncertainty.
Parameter sensitivity and walk-forward
- Grid-search key inputs and visualize heatmaps where metrics stay stable.
- Use walk-forward windows (e.g., 6m optimize, 3m test) to imitate live adaptation.
- Avoid chasing the best single configuration; prefer robust neighborhoods.
Reporting and communication
- Capture assumptions (fees, slippage, sizing) next to metrics for transparency.
- Save parameter sets and results to compare revisions; annotate what changed and why.
- Watch for regime shifts where performance patterns break; adjust or disable accordingly.
Tools to tighten assumptions
PineScripter.app produces production-leaning code with clearer inputs and exits, making it easier to test realistic settings. For quick idea drafts, tryPineify orPine Script Wizard—but always verify assumptions before trusting results.