GUIDE · TESTING A STRATEGY

Is TradingView backtesting accurate?

As accurate as its settings. The Strategy Tester replays your script's orders against the chart's candles, and its defaults decide the answer: no commission, no slippage, the moves inside each candle guessed from its open, high, low and close, and, in Pine v6, every order sized at 100% of equity under a margin rule that can skip entries. On an RSI(2) strategy on SPY from 2016 to 2026, the margin rule alone turned 90 trades into 34.

What it assumes by default

Each default below is from TradingView's own Pine manual, reference or pricing page. Most can be changed in the strategy() declaration or in the strategy's Settings, under Properties.

SettingDefaultWhat it doesFix
CommissionnoneEvery result is too kind.Set commission_type and commission_value.
SlippagenoneEvery order fills at the exact price.Set slippage, or add a percent to the commission.
Order size and margin100% of equity, margin 100A long may spend only its own cash, so an entry that costs more at the fill is skipped.Set margin_long = 0, or size under 100%.
Fill timingnext openOrders made on a candle's close fill at the next candle's open: realistic.Leave process_orders_on_close off.
Inside a candleguessedThe path runs from the open to whichever extreme is nearer, then the other. A stop and a target inside one candle can fill in the wrong order.Bar Magnifier on Premium and Ultimate, or a lower timeframe.
Limit ordersfill on touchFilled as soon as price reaches the limit, which a thin market might not do.Set backtest_fill_limits_assumption.
Chart typethe chart's ownOn Heikin Ashi, Renko and other synthetic charts the orders fill at synthetic prices.Test on standard candles.
Historythe chart's candles5,000 on the Basic plan: twenty years of daily candles, a few months of 5-minute ones.A paid plan, or Deep Backtesting from Premium.
A held-out periodnoneThe whole result is in sample: tuned and judged on the same data.Test a later period by hand.

Worked example: the margin default on one strategy

The RSI(2) pullback on SPY from the how-to, 4 January 2016 to 19 October 2026, run in our tester, which follows TradingView's order rules here. Once as built, with margin_long = 0, and once with Pine's default margin restored:

MarginTradesBefore costsAfter costs
margin_long = 090+42.8%+24.8%
Pine's default, 10034+21.2%+15.3%

At 100% of equity the order size is worked out from the close of the candle that triggered it. When the next candle opens higher, the order costs more than the cash, and the default margin refuses it: 56 of the 90 entries went that way, and nothing in the result says so except the trade count. The before-and-after columns are the second default at work: the costs TradingView leaves at zero took 18 points of the 42.8.

How much history each plan gives

The Strategy Tester runs on the candles the chart has loaded. On daily candles even the Basic plan's 5,000 cover about twenty years. On intraday candles the limit bites:

PlanCandles5-minute candles cover
Basic5,000about 64 sessions
Essential and Plus10,000about 128 sessions
Premium20,000about 256 sessions
Ultimate40,000about 513 sessions

Counted in regular US sessions of 78 five-minute candles. Deep Backtesting, from Premium, tests the whole history rather than what the chart has loaded.

Before you trust a TradingView backtest

  1. Costs are set
    commission_type, commission_value and slippage in the declaration, at least what your broker and the spread cost.
  2. The margin cannot skip entries
    margin_long = 0, or an order size under 100% of equity. Count the trades against the entries you expect.
  3. Orders fill at the next open
    process_orders_on_close off, and entries read from candles that have closed.
  4. The chart is standard candles
    Not Heikin Ashi, Renko or another synthetic type, unless fills use standard prices.
  5. There are enough trades
    Twenty or more, over at least a year. Fewer, and the result could be luck either way.
  6. A later period was held out
    Settings chosen on the earlier part, the later part run once, unchanged.

Our free tester starts from the other side: costs on, next-open fills, and the last stretch held out and judged in one word. The details are in commission and slippage, explained and out-of-sample testing.

Questions

Usually the settings. By default a strategy pays no commission and no slippage, the path inside each candle is guessed from its open, high, low and close, and limit orders fill as soon as price touches them. Live, you pay the spread and fees, and fills are not guaranteed.

Sources, read on 20 October 2026: TradingView's Pine Script manual, “Strategies” (the broker emulator, intrabar assumptions, bar detail on Premium and Ultimate, limit orders, non-standard charts), the Pine Script v6 reference for strategy() (default order size and margin), its pricing page (historical candles per plan) and its help page on Deep Backtesting. The numbers are our engine's, on our daily data. TradingView belongs to its owner, and Alpha Charts is not affiliated with it.