TradingView Backtest: 5 Numbers That Mislead
You paste a Pine Script onto your TradingView chart — Pine Script is the built-in scripting language for indicators and strategies. You hit Add Alert but can't find Any alert() function call. The Strategy Tester panel is grayed out. Backtesting won't run, you can't see win rate or net profit.
What nobody tells you upfront: only scripts starting with strategy(...) get a Strategy Tester. Those starting with indicator(...) don't. This has nothing to do with your plan or how much you pay — it's Pine Script's Rule Zero from the official documentation, yet almost no one mentions it.
This article doesn't cover "how to design a strategy" — that's a different topic. We've already written[Three Pitfalls of Retail Quantitative Trading: Overfitting, Survivorship Bias, and Lookahead Bias](/blog/en/quant-for-retail). This piece does three things: get the backtest running, understand the numbers on the panel, and lay out the five default values in strategy() that secretly change results against the official documentation.
strategy() page of the Pine Script v6 Language Reference Manual (verification date: September 15, 2026). Platform feature availability by plan is cross-referenced against the plan comparison table on tradingview.com/pricing; paid tiers may change at any time, so we recommend checking the current version yourself before proceeding.Gap One: Is Your Script an indicator or a strategy?
Pine scripts come in only two flavors: indicator(...) does visual rendering only, while strategy(...) places simulated orders and generates performance tables. The official documentation states this plainly, yet AI-generated Pine scripts often mix them up — you ask it to "write me an RSI reversal strategy" and the first line it gives you is indicator("RSI Reversal"). Such a script won't even open the Strategy Tester.
The fastest way to tell: look at the first executable function in the file. Only strategy() gets a Strategy Tester. A single script won't have both declarations — you only need to check that one line.
| Question | Answer |
|---|---|
| First line says indicator()? | No Strategy Tester panel. To backtest, must rewrite as strategy() |
| First line says strategy()? | Strategy Tester tab appears below the chart; click it to see the performance table |
| Neither (not declared)? | Pine v6 requires a declaration; compilation fails directly |
How to tell whether a script can be backtested (verification date: September 2026, Pine Script v6)
Changing indicator() to strategy() isn't just swapping a word — the latter adds a bunch of parameters related to capital, leverage, and commissions (we'll go through each in Section Five). But these **all have default values**. Leave them blank and Pine will still run, except the numbers it produces are TradingView's official defaults, not your actual situation.
Gap Two: Can the Basic plan run backtests? Yes, but these three things will block you.
The free Basic plan can open the Strategy Tester — you can apply a strategy() script you wrote or someone shared, see the performance numbers on the Overview tab, and view the List of Trades. This step doesn't require payment.
What usually blocks you isn't "can't open it" but these three things:
| Basic (Free) | Premium and above | ||
|---|---|---|---|
| Open Strategy Tester, view Overview numbers | |||
| Bar Magnifier (simulate fills using lower timeframe data) | |||
| Pine computation time limit | 20 seconds | 40–100 seconds | |
| Max indicators per chart | 2 | 25–50 | |
| Webhook notifications (auto POST signals to other services) |
Differences in backtest experience between Basic and Premium (as of September 2026, sources: tradingview.com/pricing and Pine v6 strategy() official reference)
Bar Magnifier is particularly noticeable — the official strategy() reference for the use_bar_magnifier parameter reads "Only Premium and higher-tier plans have access to this feature". Basic users who haven't paid, even if they check the box, won't get it to work.
One candle on a 1-hour chart may have already triggered a stop-loss and pulled back internally. The Basic mode can't see that process — it only uses open/high/low/close. If you're doing long-term automated trading, Premium is usually the threshold — webhook, which auto-POSTs alert triggers to your own server or third-party service, isn't available on Basic from the start. We broke down the five plans' actual differences with webhooks in[Five Plans Compared: Backtesting and Webhook Differences](/blog/en/tradingview-plans-webhook-comparison) — we won't repeat it here.
Strategy Tester Panel: What Each Tab Is Showing You
After adding a script to the chart, the Strategy Tester panel below lists several tabs, each serving different decisions — looking at the wrong one means you'll miss critical information. Below are the core tabs you'll likely use (actual listed tabs and names may vary slightly with TradingView version):
| Tab | What It Shows You | When to Look at It |
|---|---|---|
| Overview | Net Profit, Percent Profitable, Profit Factor, Max Drawdown, and other summaries | First glance to judge whether the strategy is worth continuing |
| Performance Summary | Breaks down each signal into All / Long / Short columns; includes Sharpe, Sortino, etc. | Deciding whether to run only long, only short, or both |
| List of Trades | Time, price, profit, run-up, drawdown for every single entry/exit | Finding which single trade caused Max Drawdown to blow up |
| Properties | All strategy() parameters used in this backtest, including unchanged defaults | Documenting the backtest; cross-referencing settings six months later |
Strategy Tester core tabs and purposes (Pine Script v6, verification date: September 2026)
A common oversight is Properties.Most people only look at Overview before drawing conclusions, but the numbers on Overview are calculated using whatever settings are on Properties. If you don't click into Properties to cross-reference, you won't know what default produced that 68% win rate — initial_capital of 1 million, fixed 1 contract per trade, zero commission, zero slippage. These are Pine defaults, not your real situation. Section Five lists them all.
The Five Bold Numbers on Overview, Each One Can Be Faked
The Overview page displays five summary numbers in the largest font. Each has its own traps, and it's easy to be led astray by pretty curves when reading through them in order.
Net Profit:The sum of all closed trades' P&L, minus commissions and slippage. The absolute amount itself means nothing — when default_qty_type is percent_of_equity, larger principal produces larger Net Profit; results from two different principals can't be directly compared. Look at this number alongside the Net Profit % next to it, or adjust initial_capital to your real trading amount and recalculate.
Percent Profitable (Win Rate):Profitable trades ÷ total trades. High win rate doesn't mean profitable — if you win $10 each time and lose $100 each time, even an 80% win rate means you're losing money. This is why the next number matters more.
Profit Factor:Total profit from winning trades ÷ total loss from losing trades. 1 means break-even; anything above 1 is meaningful. Practical judgment benchmarks: below 1.2 usually won't survive real-world slippage and commissions; above 2.0 you should first suspect that commission or slippage isn't set (Section Five).
Max Drawdown:The largest drawdown from peak to trough during the **backtest period**. This is "the worst that historically happened," not "the worst that could happen going forward" — a deeper drawdown may appear out of sample. When you look at this number, ask yourself: would I have closed the strategy if I really saw my account drop this much at that moment? If yes, this strategy hasn't truly been backtested on you yet.
Total Closed Trades:How many trades the strategy completed in this history. When this number is too small (e.g., under 10), the four numbers above have zero statistical meaning — one lucky streak can make win rate and Profit Factor look great. Rough rule of thumb: **single digits ignore, double digits suspect, triple digits start to be meaningful**.
Five strategy() Default Values That Directly Change Your Backtest Results
The strategy() declaration function has thirty-something parameters, all with defaults. Leave them all blank and it compiles fine and produces a pretty performance table — but those numbers are **calculated using the official defaults**. This is where beginners get tricked most easily. Below are the five that have the biggest impact:
(One) Three parameters related to capital and position size
| Parameter | Official Default | How to Set in Reality |
|---|---|---|
initial_capital | 1000000 | Set to the amount you'd actually trade, matching your exchange balance |
default_qty_type | strategy.fixed | Most people want strategy.percent_of_equity |
pyramiding | 0 (rejects adding positions) | Confirm you don't need pyramiding; set to 2, 3, etc. if you do |
Pine Script v6 strategy() capital/position defaults (verification date: September 15, 2026)
(Two) Two parameters related to cost
| Parameter | Official Default | How to Set in Reality |
|---|---|---|
slippage | 0 (ticks) | For crypto perpetuals, use 1–3 ticks; more for highly volatile pairs |
commission_value | 0 | Use the exchange's actual taker fee rate; check on that exchange's page |
Pine Script v6 strategy() cost defaults (verification date: September 15, 2026)
strategy() reference for pyramiding reads "If the value is 0, only one entry order in the same direction can be opened, and additional entry orders are rejected" — default 0 means "only one entry per direction allowed; subsequent same-direction entries are rejected." So if you call strategy.entry("Long", strategy.long) twice in a script, the second won't add a position but will be discarded entirely. If your backtest results show dramatically fewer trades than expected, this is usually why. To enable pyramiding, you must actively set pyramiding = 2 or another specific number.One easy-to-miss parameter: risk_free_rate. Pine v6 reference for it reads "It is used to calculate the Sharpe and Sortino ratios. Optional. The default is 2." — a default of 2 means 2%. This assumes the annual risk-free rate commonly used in stock markets; if you're evaluating crypto strategies, Sharpe and Sortino will run low. Whether to change this depends on what benchmark you're comparing against — verify what two numbers it affects before making a move.
The request.security Lookahead Trap Is a Separate Issue
If your strategy uses multiple timeframes (e.g., calling daily data inside an hourly script), there's another set of defaults that can make backtest numbers look unrealistically good. This topic already has a dedicated article:[The request.security Lookahead Trap: Beautiful Backtests That Don't Match Live Trading](/blog/en/request-security-lookahead-trap).
In one sentence: Pine v6's request.security has a parameter called lookahead, and the official reference for it reads "The default is barmerge.lookahead_off starting from Pine Script® v3." — **the default is already safe (won't sneak in future data)**. So that article actually covers the variant where "someone actively turned on lookahead_on" or "historical data aggregation itself has timing mismatches," not a defaults problem. This is a sixth parameter not included in Section Five's table because its default doesn't cause issues — only active changes do.
Heikin Ashi, Renko, and Other Non-Standard Charts: Officially "Not Recommended"
The Strategy Tester can run on Heikin Ashi, Renko, Point & Figure, and other non-standard charts, but the results will mislead. This isn't our opinion:
strategy() pageThe mechanism reason is that these chart types' candle prices are **synthesized**. Here's the comparison:
| Chart Type | Where Candle Prices Come From | Suitable for Backtesting |
|---|---|---|
| Standard Candles | Actual open/high/low/close of the current candle | Yes |
| Heikin Ashi | Averaged from previous and current candle prices, not real trades | Not recommended by official docs |
| Renko / Kagi / Line Break | Synthesized candles auto-stacked from price movement thresholds | Not recommended by official docs |
| Point & Figure | Adds a column only at specific price changes, no timeline candles | Not recommended by official docs |
Why non-standard charts give you unrealistic backtest results (Pine Script v6, verification date: September 2026)
Pine's strategy.entry() uses synthetic prices as entry prices, which won't match what you'd actually trade on the market. Backtests look smooth; live trading reveals the same signals appear at the same time but with very different fill prices.
Workaround: strategy() has a fill_orders_on_standard_ohlc parameter; set to true it forces standard OHLC fills (even on Heikin Ashi charts). But this only fixes fill price, not the fact that signals themselves come from reading synthetic candles — for serious backtesting, just switch back to standard candle charts.
An Honest Section: Backtests Look Backward, Not Forward
By now you can read the panel numbers and know which defaults to change. But this must be stated clearly here — backtesting is fundamentally **using what has already happened** to approximate **what may happen in the future**, and the two will never perfectly align. This isn't a TradingView technical limitation; it's an inherent limitation of backtesting itself.
So even if you adjust all the defaults above to near-live conditions, your Profit Factor reaches 1.8, Max Drawdown is only 12% — the strategy could still blow up 15% in its first week on live trading. That doesn't mean you did anything wrong; it just means backtest numbers have never guaranteed that outcome.
What you should actually do is record your backtest results well — period, asset, parameters, initial capital, commission and slippage assumptions, all written down — then compare every single live trade's result against this record going forward. The bigger the gap between live and backtest, the more fragile the strategy's assumptions about the environment. There's no shortcut.
Before going live with any new strategy, write these five things down and archive them. Six months later when you ask yourself "why is this behaving like this," this record is the only thing that can cross-reference the answer.
- Backtest Period — which years, spanning which market conditions (bull, bear, sideways)
- Asset — which exchange, which candle timeframe, which trading pair
- Non-default strategy() Parameters — list all the parameters you actively changed and their values
- Whether Bar Magnifier Is On — constrained by plan, state "off" explicitly if so
- Commission and Slippage Assumptions — how much commission_value and slippage each is set to
Frequently Asked Questions
Can I use Basic plan backtest numbers?
AI generated Pine that looks profitable in backtest — can I connect it to auto-trading?
Profit Factor above 3 — is that good?
Backtest and live results differ a lot — is TradingView broken?
Can I publish backtest results on a blog or social media?
Get started
Backtest is running smoothly and you want to auto-connect signals to exchanges — TVSBot uses your own API key, starts with dry-run, risk controls are yours — turning Pine signals into real orders, no separate server needed.
Start Free- Three Pitfalls of Retail Quantitative Trading: Overfitting, Survivorship Bias, and Lookahead Bias
- The request.security Lookahead Trap: Beautiful Backtests That Don't Match Live Trading
- Pine Script Beginner — Write Your First Strategy in 30 Minutes (v6 Complete Guide)
- Indicator Repainting: Signals Disappear, But Orders Already Filled
- Which of Five TradingView Plans Can Run Webhooks? (2026)