TradingView Backtesting: How to Backtest a Strategy Step by Step, With a Real Example
How to backtest on TradingView, automatically with the Strategy Report or by hand with Bar Replay, what each plan allows, the settings that change a result, and an RSI rule checked against our own test bench.

On this page
- What each TradingView plan allows for backtesting
- How to backtest on TradingView with the Strategy Report
- The settings that change a TradingView backtest
- How to backtest manually with Bar Replay
- Example: backtesting an RSI rule, and what our bench found
- The trap of tuning the inputs
- TradingView or another backtesting tool?
- Frequently asked questions
There are two ways to backtest on TradingView. The automatic way runs a strategy, a Pine Script that places orders, on the chart's history and shows the result in the Strategy Report at the bottom of the screen. The manual way uses Bar Replay to hide the future and step through past bars one at a time, taking each trade by hand. Both work on the free Basic plan; paid plans add more history, the full set of report metrics and, from Premium, Deep Backtesting on all of a symbol's history. This tutorial walks through both, then runs a concrete example, an RSI rule, and compares it with what that rule gave on our own test bench. Every fact about TradingView below was read on its help center, its Pine Script documentation and its pricing page on December 3, 2026.
What each TradingView plan allows for backtesting
A strategy can only test the bars the chart loads, so the plan sets how far back an ordinary backtest goes: from 5,000 bars on Basic to 40,000 on Ultimate. Deep Backtesting removes that ceiling, on Premium and Ultimate only.
TradingView backtesting features by plan
| Plan | Price | Bars a strategy can test | Strategy Report | Bar Replay | Intrabar detail | Checked |
|---|---|---|---|---|---|---|
| BasicFor: Daily strategies and first tests | Free | 5,000 historical bars | Basic report metrics | Daily and higher bars | Chart bars only | Source: tradingview.com |
| EssentialFor: Swing traders who want every metric | $14.95 a month, or $12.95 a month billed annually | 10,000 historical bars | Advanced report metrics, export in XLSX | Minute bars, 6 months back | Chart bars only | Source: tradingview.com |
| PlusFor: Intraday traders testing on minute bars | $34.95 a month, or $29.95 a month billed annually | 10,000 historical bars | Advanced report metrics, export in XLSX | Minute bars, 1 year back | Chart bars only | Source: tradingview.com |
| PremiumFor: Traders who test on a symbol's full history | $69.95 a month, or $59.95 a month billed annually | 20,000 historical bars; Deep Backtesting on all the symbol's history | Advanced report metrics, export in XLSX | All minute bars stored, second bars | High detail of historical bars from lower timeframes | Source: tradingview.com |
| UltimateFor: Professional users who need the highest limits | $239.95 a month, or $199.95 a month billed annually | 40,000 historical bars; Deep Backtesting on all the symbol's history | Advanced report metrics, export in XLSX | All minute and second bars, ticks 7 days back | High detail of historical bars from lower timeframes | Source: tradingview.com |
On a daily chart, 5,000 bars is about twenty years of stock market sessions, which is enough for most swing trading tests on the free plan. On a 1-minute chart of a US stock, with 390 bars in a regular session, the same 5,000 bars cover about 13 sessions, and that is where paid plans start to matter.
Historical bars a TradingView chart loads, by plan

How to backtest on TradingView with the Strategy Report
The Strategy Report is what many traders still call the TradingView Strategy Tester: the panel that opens under the chart when a strategy runs. Here are the steps.
- Open a chart of the symbol and the interval you want to test, for example a daily chart of the S&P 500 ETF.
- Add a strategy. Click Indicators on the top toolbar, or press the slash key, then pick a strategy in Technicals, then Strategies, for a built-in one, or in Community for one shared by other traders. Your own scripts are under Personal. Only one strategy runs on a chart at a time.
- Open the report. It opens on its own at the bottom of the screen when a strategy is added; buy and sell arrows appear on the chart where the strategy traded.
- Set the costs before you read anything. In the strategy's settings, enter a commission and a slippage. Pine Script's documentation states that if no commission is specified, the strategy applies none, so a report left on its defaults shows a result no account could earn.
- Choose the date range in the Metrics tab, then read the equity chart, total P&L, max drawdown, profitable trades and profit factor. Turn on Buy&hold to draw the comparison line: a strategy that loses to simply holding the symbol has not earned its trades.
- Open the list of trades. Each row gives the trade number, type, date and time, signal, price, position size, net P&L, run-up, drawdown and cumulative P&L. Check a few trades by hand on the chart: it is the quickest way to catch a script that does not do what you think.
- Extend the test. On Premium and Ultimate, select a longer time range and Deep Backtesting launches on its own, marked by a pink icon, on up to two million bars. Its results appear in the report, not on the chart; after changing the strategy, click Update report.
The settings that change a TradingView backtest
TradingView's broker emulator has to guess how past orders would have filled. These are the assumptions that move a result the most, as its Pine Script documentation and help center describe them.
| Setting | Default behavior | Why it matters |
|---|---|---|
| Fill timing | An order is filled at the open of the next bar at the earliest, since the script calculates once a bar closes | Filling at the signal bar's close would use a price nobody could trade on |
| Commission | None if not specified | Frequent trading strategies can turn from profit to loss once costs are in |
| Path inside a bar | Open, low, high, close when the open is nearer the low; open, high, low, close when it is nearer the high; no gaps inside a bar | With a stop and a target in the same bar, this guess decides which one fills |
| Bar detalization | Off; on Premium and Ultimate, lower timeframe data can replace the guess | Removes much of the intrabar guesswork for stops and targets |
| Limit order execution | Choice between the requested price, or the requested price and 1 tick beyond | A limit touched once is not always filled in real trading |
| Script execution mode | Once per bar close | TradingView warns that changing it can cause repainting, and that running a strategy after order fills can cause lookahead bias on historical bars |
| Chart type | Standard candles or bars | Heikin Ashi, Renko and other non-standard charts do not reflect actual market prices by default |
When an order triggered at the close can fill

Inside one bar: which order fills first

How to backtest manually with Bar Replay
A manual backtest suits rules that are hard to code, such as chart patterns: you play the past one bar at a time and take each trade by hand, without seeing what comes next.
- Write the rule down first: what makes an entry, where the stop goes, where the target goes.
- Click Bar Replay on the top toolbar; the button looks like a rewind button. Pick a start with Select bar, or Random bar so you do not land on a move you remember.
- Advance bar by bar with Shift and the right arrow, or start and pause playback with Shift and the down arrow.
- Log each trade in a spreadsheet, with entry, stop, exit and result in R, the multiple of the risk. Drawings made during the replay stay on the chart afterwards.
- Stop at a set number of trades, 50 for example, decided in advance, then count the wins, the losses and the average R.
Daily and higher bars can be replayed on every plan, the free one included. Minute bars start with Essential, 6 months back; Plus goes back 1 year; Premium and Ultimate replay all the stored history, and second bars from August 2022. Two limits apply: no new alerts can be created during a replay, and orders sent through Paper Trading while replaying are filled at real-time prices, not at the bar on screen. Our guide to TradingView paper trading shows the Replay Trading mode made for that.
Example: backtesting an RSI rule, and what our bench found
A concrete example makes the steps clearer. Take one of the most common rules on TradingView: buy when RSI(14) drops under 30, sell when it crosses back over 50. On TradingView you would code it as a Pine Script strategy, or find a version of it in the Strategies tab, add it to a daily chart of the S&P 500 ETF, set a commission, and read the report.
RSI(14) on the daily S&P 500 ETF: the rule buys under 30, sells over 50

- Price, daily candles (hollow up, filled down)
- RSI(14), Wilder averages (solid line)
A single chart is a small sample, though. On our test bench, we ran this exact rule on our daily price data for stocks, ETFs, forex, crypto and commodities, up to October 30, 2026, with trading costs, and compared each trade with the other assets of the same market over the same bars. On 93,150 signals, the trade made +2.24% on average, 0.53% more than the market. The common MACD rule, buying when MACD crosses over its signal line, made +0.60% per trade but 0.21% less than the market over the same bars: profitable on its own, worse than the market. A report without a benchmark would have shown both as winners.
The trap of tuning the inputs
The Strategy Report makes it easy to change the RSI length or the threshold and rerun until the numbers look good. The best line of that search always looks strong, because it is the best of many tries. We measured how much of it survives. On SPY, we picked the best of 41 moving average crossover pairs over 3 calendar years, then ran it unchanged on the next year, 29 times from 1997 to 2025. While tuning, the winner beat buy and hold by 2.4% a year on average; in the following, unseen year, it trailed buy and hold by 4.5% a year. Across all 43 unseen years of the test, on SPY, EUR/USD and Bitcoin, the tuned winner beat on average 52.9% of the other pairs, about what a pair drawn at random would do.
The three periods of a strategy test

The defense is simple: tune on the first part of the history, freeze the inputs, and run the frozen strategy once on the last part, which the tuning never saw. In the Strategy Report, that means setting the date range to the tuning years first, then to the later years. Our strategy tester page details the full test and the checks that apply to any tester, and our backtesting guide covers look-ahead, overfitting and survivorship bias with a worked example.
TradingView or another backtesting tool?
TradingView is a good place to backtest one symbol at a time, on rules you can write in Pine Script. Testing a rule on a whole list of stocks at once, or a robot on forex tick data, is easier elsewhere: our comparison of the best backtesting software covers the alternatives, among our other trading reviews, and our guide to the TradingView plans compares the five plans in detail. If the limits above rule TradingView out, our list of TradingView alternatives compares the platforms that test rules differently, and our comparison of the best trading simulators covers practice on live and past prices.
From our own tests: do chart patterns work? · chart patterns cheat sheet · candlestick patterns cheat sheet
Frequently asked questions
Can you backtest on TradingView for free?
Yes. Strategies, the Strategy Report with its basic metrics, Pine Script and Bar Replay on daily bars are all on the free Basic plan, which loads 5,000 historical bars. Paid plans add more bars, the advanced report metrics and XLSX export from Essential, and Deep Backtesting from Premium.
Where is the Strategy Tester on TradingView?
TradingView now calls it the Strategy Report. It opens on its own at the bottom of the chart when you add a strategy from Indicators, then Technicals, then Strategies, or from Community. Its Metrics tab holds the equity chart, total P&L, max drawdown, profitable trades and profit factor, and the List of trades shows each trade.
How do I backtest manually on TradingView?
Use Bar Replay: click the rewind-like button on the top toolbar, choose a start bar or Random bar, and advance with Shift and the right arrow. Take each trade by hand by your written rules and log it. Daily bars work on every plan; minute bars start with Essential, 6 months back.
What is Deep Backtesting on TradingView?
An option on Premium and Ultimate that tests a strategy on all the available history of a symbol instead of the bars loaded on the chart, up to two million bars and one million trades. It starts when you select a longer time range; results appear in the Strategy Report, not on the chart.
Is TradingView backtesting accurate?
It is as accurate as its assumptions. By default an order fills at the next bar's open, no commission is charged unless you set one, and the path inside each bar is guessed from its open, high, low and close. Set costs, check the list of trades, and keep part of the history out of any tuning before you trust a result.
Sources
- TradingView help: TradingView Strategy Report, how to start
- TradingView help: How Deep Backtesting works
- TradingView help: What are strategies, backtesting and forward testing?
- TradingView Pine Script documentation: Strategies
- TradingView help: Bar Replay, how and why to test a strategy in the past
- TradingView help: How much data is available for Bar Replay
- TradingView pricing and plan comparison
