Backtesting guide
Backtesting definition for trading and investing
Backtesting is the process of applying a fixed strategy to historical data to estimate how the rules would have behaved under specified data, cost, sizing, and execution assumptions.
Read the practical guideKey Takeaways
- A backtest is a conditional historical measurement, not a prediction.
- The result belongs to one code version, dataset, time range, and settings package.
- Look-ahead bias, selection bias, overfitting, and unrealistic costs can invalidate the conclusion.
- Forward testing observes later behavior but still does not guarantee live results.
What a backtest measures
A backtest measures the simulated trades and equity path produced when fixed rules are applied to selected historical data. It can compare two implementations or assumptions under controlled conditions. It cannot show what would have happened under different data, fills, code, or decisions that were not included in the test.
The minimum backtest record
Preserve the strategy source or exact rules, symbol or universe, timeframe, dates, data provider, session, parameters, position size, commission, slippage, order-processing settings, and platform version. Without that package, a result is difficult to reproduce and should not be treated as a reliable comparison.
- Rules and code version.
- Data source, market, period, and session.
- Parameters, costs, sizing, and execution settings.
- Trade list, equity path, and notes.
What backtesting cannot prove
Historical success cannot prove future profitability, fill quality, liquidity, or operational reliability. TradingView warns about look-ahead bias, selection bias, overfitting, and the hypothetical nature of its strategy report. Use an untouched period and forward simulation to reduce uncertainty, not to convert the result into a guarantee.
Related Pineify workflow
Turn the definition into a reproducible TradingView workflow
Once the rules are explicit, Pineify can generate editable Pine Script strategy source. After a baseline passes review, Strategy Optimizer can automate a defined set of TradingView inputs.
Translate explicit entry, exit, sizing, and risk rules into editable strategy code.
Create Pine Script strategy codeAutomate selected TradingView inputs after the baseline result is understood.
Review Strategy OptimizerBoundary: Pineify does not provide historical market data or execute the TradingView simulation. Optimization cannot repair an ambiguous or biased test.
Primary sources
- TradingView Pine Script documentation: StrategiesVerified 2026-08-07
This page is educational and does not provide investment advice. Backtests are hypothetical, depend on their data and assumptions, and do not guarantee future results. Trading can result in substantial loss.