Skip to content
All trading strategy guides

How to backtest a Pine Script strategy in TradingView

Open a standard candlestick chart, paste your strategy into Pine Editor, and add it to the chart. Use the chart’s Strategy Report to inspect simulated orders, drawdown, and the trade list.

Choose the strategy export

In PipsProof, approve your rules and open Code & test. Select TradingView and the strategy export. Choose the indicator export when you want setup markers or levels on the chart. The strategy export supplies the simulated order logic used for backtesting.

Set the chart and test dates

Select the intended ticker and data feed and use the timeframe from the approved rulebook. Paste the code into a new strategy in Pine Editor, save it, and add it to the chart. Set Backtest start and Backtest end in the script inputs. The dates filter available bars from the selected chart history.

Review fills and costs

Check initial capital, commission, and slippage in Strategy Properties. TradingView expresses slippage in ticks. Review the first few trades against your examples, checking the signal candle separately from the simulated fill. If a setup is missing, first check the feed, timeframe, dates, and rule conditions.

Keep a baseline before refining

Save the rulebook version and tester settings with your result. If you bring the report back to PipsProof for AI review, consider one change at a time and compare it with the baseline. Use a separate date range to check whether the result holds outside the period you refined on.

Does a Pine Script indicator run in the Strategy Tester?

Use a Pine strategy to simulate orders and produce a performance report. Use an indicator to inspect setups and drawings on the chart.

TradingView Pine Script strategy documentation