Tradelyze

Guide

How to backtest on TradingView

Last reviewed: 16 September 2026·Tradelyze

To backtest on TradingView, add a Pine Script strategy to a chart, and the Strategy Tester panel below the chart replays it on past bars and lists every simulated trade. Before trusting the result, set costs and order size, check how much history was tested, and export the trade list so the backtest can be checked independently.

In plain English

A backtest replays a trading idea's rules on past prices to see which trades it would have taken. On TradingView those rules have to be written as a strategy: a script in Pine Script, TradingView's programming language, that places pretend buy and sell orders. An indicator only draws lines and signals, so it cannot be backtested until it is turned into a strategy. The results panel under the chart is called the Strategy Tester by many traders and the Strategy Report in TradingView's newer help pages; both names mean the same panel.

New to this? Start with What is backtesting?

What do you need before backtesting on TradingView?

To backtest on TradingView you need a TradingView account, a chart of the market and timeframe you want to test, and a strategy script. A strategy script is Pine Script code declared with strategy() that places simulated orders with commands such as strategy.entry(). TradingView's Help Center describes strategies as scripts “able to send, modify, execute, and cancel buy or sell orders and simulate real trading right on your chart.”

This matters for your money because a strategy that has never been backtested has no track record at all. A backtest cannot prove a strategy will make money, but it shows how the rules behaved on past prices. That is the minimum to know before paying for a prop firm challenge or trading a live account.

A TradingView backtest in five steps, followed by an independent check of the exported files A conceptual flow diagram with no data. The top row shows five steps inside TradingView, left to right. Step 1, Add strategy: from the Indicators menu or the Pine Editor. Step 2, Set properties: costs, order size and bar detail. Step 3, Pick history: the bars loaded on the chart, or a chosen date range with Deep Backtesting. Step 4, Read report: the Metrics and List of trades tabs. Step 5, Export files: the trade list CSV and a price data CSV. An arrow from step 5 leads to a bottom row of checks done outside TradingView. First, re-run the same script on the same price bars, which in Tradelyze is the Baseline Matching stage. Second, compare the trades one by one, which Tradelyze reports as Match Rate, Matched, TV Only and BT Only. Third, test the settings on data they were not tuned on, with walk-forward, robustness and prop firm rule checks. Inside TradingView 1 · Add strategy Indicators menu or Pine Editor 2 · Set properties costs, order size, bar detail 3 · Pick history loaded bars, or Deep Backtesting 4 · Read report Metrics and List of trades 5 · Export files trade list CSV, price data CSV then, outside TradingView, check the exported files Re-run script on same bars Tradelyze: Baseline Matching Compare trades one by one Match Rate, Matched, TV Only, BT Only Test on unseen data walk-forward and robustness prop firm rule checks
Figure 1. A TradingView backtest takes five steps: add the strategy, set its properties, choose how much history it runs on, read the report and export the files. An independent check starts from those exported files, re-running the same script on the same prices before anything else is tested.

How do you add a strategy to a chart and open the Strategy Tester?

You add a strategy to a TradingView chart from the Indicators menu or from the Pine Editor, and the Strategy Tester panel opens by itself under the chart. There is no separate run button: adding the strategy runs the backtest on the bars the chart has loaded.

  1. Open a chart on the symbol and timeframe you want to test, using a standard candle or bar chart.
  2. Click the Indicators button in the upper toolbar, or press the / key, as TradingView's Strategy Report guide describes. Search for the strategy by name, or browse Technicals → Strategies or Community.
  3. For your own code, paste the script into the Pine Editor and choose Add to chart, the route TradingView's Pine Script documentation describes.
  4. Wait for the report. TradingView's guide says the report “opens automatically when you add any strategy” and that only one strategy can run on a chart at a time.
  5. Read both the chart and the report. The Pine Script documentation says a strategy plots trade markers on the price bars. The report has two main tabs: Metrics, a summary of performance, and Trades, the simulated trades in time order.

The names shift between TradingView pages. The current Help Center guide calls the panel the Strategy Report and its trade tab List of trades, and the Pine Script documentation calls that tab Trades. TradingView's Help Center article on historical intraday data still says Strategy Tester, as does Tradelyze's upload screen. All of them mean the same panel.

No trades in the report?

TradingView's Pine Script FAQ lists three common causes when a strategy runs but places no orders. The script may never reach a strategy.entry() or strategy.order() call. The initial capital may be too small for the position, which matters on futures, where the FAQ notes a position costs the chart price multiplied by the point value. Or the script may have a runtime error, shown by a red exclamation mark next to its name.

Which strategy properties should you set before reading results?

Set commission, slippage, order size, initial capital and pyramiding before reading any TradingView backtest result, because the defaults leave trading costs out. TradingView's Pine Script documentation says a strategy with no commission settings “applies no commission to filled orders,” and that the default slippage is 0 ticks. A tick is the smallest price step a market can move. All of these live in the strategy's Settings, on the Properties tab, and can also be written into the script's strategy() line.

Strategy properties to check first, with the defaults TradingView's Pine Script documentation gives
SettingPine Script parameterDefaultWhat it changesSource
Commissioncommission_type, commission_valueNo commissionA fee on every filled order: flat per order, per contract, share, lot or unit, or a percentage of the order's valuePine Script User Manual, Strategies
Slippageslippage0 ticksFills each order a fixed number of ticks worse than the intended pricePine Script User Manual, Strategies
Default order sizedefault_qty_type, default_qty_valuestrategy.fixed and 1: one contract, share, lot or unitHow much each entry buys or sells when the entry command gives no quantityPine Script User Manual, Declaration statements
Initial capital and account currencyinitial_capital, currency1,000,000, in the chart's quote currency (currency.NONE)The size of the simulated account, which sets percentage returns and percent-of-equity order sizesPine Script User Manual, Declaration statements
Pyramidingpyramiding1: a strategy can open a position but not add to itHow many entries in the same direction one position may holdPine Script User Manual, Strategies
Order execution delayprocess_orders_on_closefalse: an order created at a bar's close fills at the next bar's openWhether a signal fills at the signal bar's close or the next bar's openPine Script User Manual, Strategies
Bar detalization (Bar Magnifier)use_bar_magnifierDefault detail: fills use only each chart bar's own pricesUses lower-timeframe bars to decide which prices inside a bar came first; Premium and Ultimate plans onlyPine Script User Manual, Strategies

Worked example (constructed illustration, not measured data): a futures strategy's report shows a net profit of $4,200 over 180 trades of one contract each. It was tested with no commission and 0 slippage. Suppose your broker charges $2.00 per contract on each order, and you allow 1 tick of slippage on each fill of a contract where one tick is worth $5. Every trade has two fills, an entry and an exit, so each trade costs $4 in commission and $10 in slippage.

Constructed example: the same 180 trades before and after trading costs
ItemCalculationAmount
Net profit with the default settingsAs reported$4,200
Commission180 trades × 2 orders × $2.00−$720
Slippage180 trades × 2 fills × $5.00−$1,800
Net profit after costs$4,200 − $720 − $1,800$1,680

Costs take 60% of the reported profit in this example, and the average trade falls from about $23.33 to about $9.33. The commission and slippage figures are assumptions, not recommendations: TradingView's documentation suggests no values, and the right ones depend on your broker and market. The documentation does warn that adding excessive slippage can produce unrealistically worse results. Each setting is explained in TradingView strategy properties.

strategy("My strategy", commission_type = strategy.commission.percent,
     commission_value = 0.05, slippage = 1)

Writing the costs into strategy(), as in this sketch, keeps them attached to the script. TradingView's Pine Script documentation describes the Properties tab as a place where users override the defaults a script declares. Values typed only into that tab are therefore not part of the code you copy, share or upload elsewhere. The same documentation describes flat per-order and per-contract commission as well as a percentage.

How do you choose the date range, and how much history does TradingView load?

A regular TradingView backtest runs on the bars the chart has loaded, so how far back it reaches depends on your plan and your chart timeframe. Picking a different period from the report's date range menu switches the test to Deep Backtesting. TradingView's Pine Script documentation calls that menu Testing period, and its Help Center lists Deep Backtesting for Premium and higher plans.

For intraday charts, TradingView's Help Center article on historical intraday data says a chart loads 5,000 bars as standard. The same article gives 10,000 for Essential and Plus, 20,000 for Premium, 25,000 for Expert and 40,000 for Ultimate. It adds a few bars back to the start of the week, month or year. The same article says daily and longer timeframes display all available data.

Intraday bars a TradingView chart loads, by plan
PlanIntraday barsSource
Basic (free)5,000TradingView pricing page; the Help Center gives 5,000 bars as the standard length
Essential10,000TradingView Help Center and pricing page
Plus10,000TradingView Help Center and pricing page
Premium20,000TradingView Help Center and pricing page
Expert25,000TradingView Help Center; not in the pricing page's comparison table in September 2026
Ultimate40,000TradingView Help Center and pricing page

Worked example (constructed arithmetic, not measured data): on a 5-minute chart, a market open 24 hours on weekdays prints 288 bars a day. A market open 6.5 hours a day prints 78. Dividing each bar allowance by those figures gives roughly how many trading days a regular backtest covers. The estimate ignores holidays and the extra bars back to the start of the week.

Constructed arithmetic: trading days covered by a 5-minute chart
Intraday bars24-hour market (288 bars a day)6.5-hour session (78 bars a day)
5,000About 17 days (3.5 weeks)About 64 days (13 weeks)
10,000About 35 days (7 weeks)About 128 days (26 weeks)
20,000About 69 days (14 weeks)About 256 days (51 weeks)
40,000About 139 days (28 weeks)About 513 days (103 weeks)

Short histories can hold very few trades. By the same constructed arithmetic, a strategy averaging two trades a day on that 24-hour market would log only about 34 trades in 17 days. Too few trades can make luck look like skill; see how many trades a backtest needs.

You can also limit a regular backtest to part of the loaded history without Deep Backtesting. TradingView's Pine Script FAQ shows a strategy that reads a start and an end date with input.time() and only allows trades on bars between them. A sketch of the idea, not a complete strategy:

startDate = input.time(timestamp("01 Jan 2025 00:00"), "Start date")
bool crossUp = ta.crossover(close, ta.sma(close, 50))
if time >= startDate and crossUp
    strategy.entry("Long", strategy.long)

A date filter cannot reach further back than the bars the chart has loaded. The loaded window also moves. TradingView's Pine Script FAQ explains that results can change as the data's starting point moves forward, calling it “a natural repainting of strategy results over time.” The FAQ suggests exporting results regularly to keep a record.

What do Deep Backtesting and Bar Magnifier change, and which plans include them?

Deep Backtesting tests a chosen date range on all the history TradingView holds for a symbol, and TradingView's Help Center lists it for Premium and higher plans. Bar Magnifier looks at smaller bars inside each chart bar to see whether a stop or a target was hit first; TradingView's Pine Script documentation lists it for Premium and Ultimate. Their limits, and how both settings affect whether a second engine reproduces your trades, are covered in Bar Magnifier and Deep Backtesting.

Can you backtest on TradingView for free?

Yes, with limits. TradingView's pricing page, checked in September 2026, lists strategy backtesting with basic report metrics on the free Basic plan, on 5,000 historical bars. The same comparison table lists advanced report metrics and exporting trades as a CSV file only from Essential up, and Deep Backtesting and high bar detail only on Premium and Ultimate.

Backtesting features by TradingView plan, as labeled in TradingView's pricing page comparison table (checked in September 2026; prices omitted)
FeatureBasic (free)EssentialPlusPremiumUltimate
Basic report metricsYesYesYesYesYes
Advanced report metricsNoYesYesYesYes
Export trades in CSVNoYesYesYesYes
Export report in XLSXNoYesYesYesYes
Deep backtestingNoNoNoYesYes
High detalization of historical barsNoNoNoYesYes
Each history tick executionNoNoNoYesYes
Historical bars available5K10K10K20K40K
Download chart dataNoNoYesYesYes

Two limits matter most on a free account. First, a short timeframe covers little history: by constructed arithmetic, 5,000 five-minute bars of a 24-hour market is only about 17 trading days. Second, Basic does not include exporting the trade list as a CSV. A backtest run there cannot be handed to an outside tool such as Tradelyze without a plan that includes the export. Plan features change, so check TradingView's pricing page before choosing a plan; this page states no prices.

Can you backtest an indicator that is not a strategy?

Not directly. TradingView's Strategy Report guide says indicators display data and signals on the chart, while strategies generate a result report. TradingView's Pine Script documentation says a script declared with strategy() gains the commands that simulate orders. To backtest an indicator's signals, convert it: TradingView's Pine Script FAQ says to replace the indicator() declaration with strategy() and add order commands triggered by the indicator's own conditions.

//@version=6
strategy("RSI 50 cross strategy")
float rsi = ta.rsi(close, 14)
if ta.crossover(rsi, 50)
    strategy.entry("Long", strategy.long)
if ta.crossunder(rsi, 50)
    strategy.entry("Short", strategy.short)

This sketch follows the example in TradingView's Pine Script FAQ. There, the original indicator only draws markers where the RSI crosses 50. The converted strategy enters long on a cross above 50 and short on a cross below. As the FAQ notes, a long entry cancels a short trade and the reverse.

Converting needs the indicator's source code. It also forces choices the indicator never made: where to exit, how large each order is, and what commission and slippage to charge. Each of those choices changes the result, so settle them before looking at the profit rather than after, or the backtest ends up tuned to the history it is judged on.

What should you check before trusting the numbers?

Before trusting a TradingView backtest, check four things. Costs must be included. There must be enough trades. The worst drawdown, meaning the deepest drop from a previous high, must be one you could survive. And the fills and settings must not flatter the result. A strong report is where checking starts. On its own it is not evidence that a strategy will keep working.

Checks to make on a TradingView backtest before trusting it
CheckWhere to lookWhy it mattersRead more
Costs are includedSettings, Properties tab: commission and slippageTradingView's Pine Script documentation says a strategy applies no commission, and 0 ticks of slippage, unless they are setStrategy properties
Enough tradesMetrics tab: number of closed tradesA handful of trades can look excellent by luckSample size
A drawdown you could surviveMetrics tab: Max drawdownTradingView's guide defines it as the greatest loss the strategy had compared to its highest profitsMaximum drawdown
Fills inside wide barsList of trades: bars whose range held both the stop and the targetWithout high bar detail, TradingView assumes the price path inside each barBar Magnifier
A standard chartChart typeTradingView's Pine Script documentation says results on non-standard charts do not reflect actual market conditions by defaultStandard OHLC fills
No repainting settingscalc_on_every_tick, calc_on_order_fills, process_orders_on_close and higher-timeframe dataTradingView's Pine Script FAQ says backtest results of a strategy that repaints, meaning it calculates differently on past bars than it would have live, are not reliableRepainting
What each metric meansMetrics tabNet profit, profitable trades and profit factor each leave something outStrategy report explained

For a prop firm challenge, the drawdown and the worst losing stretch matter more than the final profit. A firm's loss limits apply throughout the challenge, not only to the closing balance. How each firm rule maps to a backtest statistic is covered in prop firm rules and backtest metrics.

The last check is whether the trades can be reproduced. A second engine re-running the same script on the same price bars should take the same trades. When it does not, check settings, timezone and data first, as why trades do not match TradingView explains.

How do you export the trade list and price data for independent validation?

Export the trade list with the Download icon on the Trades tab of the Strategy Tester, which saves a CSV file, and export the price bars with Download chart data. TradingView's pricing page, checked in September 2026, lists CSV trade export from the Essential plan up and chart data download from the Plus plan up.

  1. Make the script match the test. Copy any value you changed in the Inputs or Properties tabs into the script's input() and strategy() defaults, save, and add the saved script to the chart again. The export then describes the same strategy as the file.
  2. Download the trade list. TradingView's Pine Script documentation says the Download icon beside the list of trades lets users “download all available data for the list as a CSV file,” including columns hidden in Column setup.
  3. Check the trade limit. The same documentation says a regular test keeps individual data for only the latest 9,000 trades, and trimmed trades are missing from downloaded CSV files. Deep Backtesting keeps them all.
  4. Download the price bars. TradingView's Help Center article How to export chart data says to choose Download chart data… from the dropdown menu on the upper toolbar, select the chart and click Download. It notes the file holds what the chart shows, so scroll left or drag the x-axis to load more history first.
  5. Keep everything aligned. Use the same symbol, timeframe and chart timezone for both files, and start the price data before the first trade so indicators have history.

The trade list and the price file are what an independent check works from: another engine replays the script on the price bars and compares its trades with TradingView's, one by one. File formats, column names and timezone settings are covered step by step in exporting TradingView trades and price data. Price data can also come from your broker, as long as you are licensed to use it.

In Tradelyze, these files go into the new-strategy wizard. The script goes on Basic Info and the price file on Upload Market Data. The trade list goes on Upload Trade CSV, whose instruction reads “Export from TradingView: Strategy Tester → Export report (CSV).” Tradelyze runs the script with the defaults written in it. Its first stage, Baseline Matching, compares the re-run's trades with yours and reports Match Rate, Matched, TV Only and BT Only.

Where this appears in Tradelyze

Every Tradelyze run starts where this page ends. It needs a Pine Script strategy, the trade list exported from TradingView's Strategy Tester and an OHLCV price file for the same symbol and timeframe. An OHLCV file lists the open, high, low, close and volume of each bar.

Tradelyze re-runs an uploaded TradingView Pine Script strategy on your price data and checks the result against your exported trade list. It then runs parameter optimization, walk-forward analysis, a five-check robustness score and prop-firm rule checks. It does not place trades, give financial advice or guarantee a challenge pass, and it is in beta. Tradelyze is not affiliated with TradingView.

To judge the whole report, not one tile, use the pre-trade checklist.

Create an account

Already a user? Open your strategies.

Frequently asked questions about backtesting on TradingView

Questions about Tradelyze accounts, results and credits are answered in the Learn FAQ.

What does a free TradingView account include for backtesting?

TradingView's pricing page, checked in September 2026, lists strategy backtesting with basic report metrics on the free Basic plan, which loads 5,000 historical bars. The same table lists advanced report metrics and exporting trades as a CSV file only from the Essential plan up, and Deep Backtesting and high bar detail only on Premium and Ultimate. Plans change, so check the pricing page before relying on a feature.

Which TradingView plans include Deep Backtesting?

TradingView's Help Center article How Deep Backtesting works says the feature is available for Premium and higher plan users. The pricing page's comparison table, checked in September 2026, marks it for Premium and Ultimate only. Deep Backtesting tests a strategy over a chosen date range on all the history TradingView holds for the symbol, up to two million bars and one million trades.

How do I test one date range without Deep Backtesting?

Add a date filter to the script. TradingView's Pine Script FAQ shows a strategy that reads a start and an end date with input.time() and only allows trades on bars inside that window. The strategy still runs only on the bars the chart has loaded, so the window cannot reach further back than your plan's history, but trades outside the chosen dates are skipped.

Why does my TradingView strategy show no trades?

TradingView's Pine Script FAQ lists three common causes when a strategy runs but places no orders. The script may never reach a strategy.entry() or strategy.order() call. The initial capital may be too small for the position, which matters on futures because a position costs the chart price multiplied by the point value. Or the script may have a runtime error, shown by a red exclamation mark next to its name.

Why do my TradingView orders fill one bar after the signal?

A strategy calculates at the close of each historical bar, so the earliest fill is the open of the next bar, according to TradingView's Pine Script FAQ. Setting process_orders_on_close = true in strategy(), or the matching option in Settings/Properties, fills orders at the signal bar's close instead. The FAQ warns this can be unrealistic: an order signaled on a session's last bar could really fill only on the next trading day.

Why did my TradingView backtest change when I had not edited it?

A regular backtest runs on the bars the chart has loaded, and that window's starting point moves forward over time, so the oldest trades drop out. TradingView's Pine Script FAQ calls this a natural repainting of strategy results. It suggests exporting results regularly to keep a record, and using Deep Backtesting or Bar Replay to test further back into history.

How do I turn a TradingView indicator into a strategy?

Replace the indicator() declaration with strategy(), then add order commands such as strategy.entry() that fire on the indicator's own conditions, as TradingView's Pine Script FAQ describes. For example, an RSI indicator that marks crosses of 50 becomes a strategy that enters long on a cross above 50 and short on a cross below. You need the indicator's source code, and you still have to choose exits, order size and costs.

How do I add commission and slippage to a TradingView backtest?

Open the strategy's Settings and fill in the commission and slippage inputs on the Properties tab, or write commission_type, commission_value and slippage into the script's strategy() declaration. TradingView's Pine Script documentation says a strategy applies no commission unless told to and that slippage defaults to 0 ticks. Writing the values into the script keeps them attached to the code wherever it is run.

Can I backtest on Heikin Ashi or Renko charts?

TradingView's Pine Script documentation strongly recommends standard chart types for testing strategies. It says results on Heikin Ashi, Renko, line break, Kagi, point & figure and range charts do not reflect actual market conditions by default. On Heikin Ashi charts only, the Standard bars option, or fill_orders_on_standard_ohlc = true in strategy(), fills orders at actual prices. The signals still come from the Heikin Ashi candles. Renko has no such option, so switch to a standard chart before testing.

Are the Strategy Tester and the Strategy Report the same thing?

Yes. Both names refer to the panel under a TradingView chart that shows a strategy's simulated trades and results. TradingView's current Help Center guide calls it the Strategy Report, while its article on historical intraday data still says Strategy Tester, as do many traders and Tradelyze's upload screen. The panel opens by itself when you add a strategy to the chart.

Does a TradingView backtest place real trades?

No. A backtest only simulates orders on past bars, and nothing is sent to a broker. TradingView's Pine Script FAQ adds that Pine Script strategies and indicators cannot directly place orders on exchanges. Traders who automate use external tools that act on alert signals sent by webhook, the FAQ says. Tradelyze does not place trades either: it re-runs and checks a backtest you upload.

Should I trust a TradingView backtest that looks very profitable?

Not on its own. A very profitable report can come from missing costs, too few trades, fills guessed inside wide bars, repainting settings, or settings tuned to the same history the report covers. Check commission and slippage, the number of closed trades, the maximum drawdown and the fill settings first. Then check whether an independent re-run on the same price data reproduces the same trades.

Sources