Most pages about TradingView Pine scripts give you a list and a promise. This one gives you a grid. We took seven strategies that are already published with full source code, kept every rule exactly as written, ran them on five instruments over almost 11 years of daily bars and on three instruments over roughly two years of hourly bars, and printed every result, including the ones that lose. Then we ran the same 56 tests again with commission and slippage set to zero, so you could see what friction costs as a number instead of a warning.
The short version: on daily bars, six of the seven made small positive returns on most instruments, and costs barely mattered. On hourly bars the picture flips. The MACD crossover went from a profit to a loss on both SPY and QQQ once costs were switched on, and on hourly BTC-USD all seven lost money with costs included. The strategies didn't change, but the trade count did.
Where the seven strategies come from, and why we picked them
The seven scripts are the ones Strategy Arena publishes on its page of free Pine Script strategies with code: RSI mean reversion, an EMA ribbon on 8/21/55, a Bollinger Band bounce, a MACD crossover, a SuperTrend direction filter, a Stochastic RSI cross and an ATR breakout with a fixed stop. Credit where it's due: that page is the most careful one on the first screen for this topic. Every script declares the same property set: 10,000 of starting capital, 10% of equity per entry, no pyramiding, 0.1% commission per order, one tick of slippage and 100% long margin.
Earlier versions of that page stopped after each script with a note that no measured result was attached. It has since been updated, and as of its 6 November 2026 revision it reports verdicts from its own online judge, all on BTCUSDT, and says none of the seven survived its sealed out-of-sample test. That's useful and honest work. What it still doesn't give you is the plain grid: trade count, win rate, profit factor and drawdown for each script, across several markets, with a zero-cost run next to it. That's the gap we filled.
We picked these seven for a simple reason: they're canonical. Nearly every "best TradingView scripts" list includes some version of them, and the code is short enough that anyone can check our port line by line. If a well-known idea only works with costs set to zero, you'd want to know that before you build anything on top of it.
What a Pine script actually is, before any number matters
"Pine script" covers three different kinds of program in TradingView's own taxonomy, and mixing them up is the first way people get misled by performance claims.
An indicator is declared with indicator(). It can draw lines, colour bars and fire alerts. It cannot place simulated orders, so it can't produce a strategy report, and when a vendor shows a win rate for an indicator, somebody built a separate strategy wrapper around it, or counted signals by hand. Either way, you're not looking at the indicator itself.
A strategy is declared with strategy(). It runs through TradingView's broker emulator and fills the Strategy Tester with net profit, trade list, drawdown and the rest. This is the only type that produces a performance report, and the report is only as honest as the settings in that strategy() line.
A library is declared with library(). It exports functions for other scripts to import and neither draws nor trades on its own.
All seven scripts in this test are strategies. If you're writing Pine Script for TradingView yourself, decide which of the three you're building before you write a line, because only one of them can ever be backtested. If you want the wider background on the language itself, our Pine Script glossary and tutorial covers syntax, versions and the common building blocks. The difference between the two types that matter here is laid out in more depth in TradingView strategies vs indicators.
Three access levels, and what each one hides
All published TradingView scripts carry one of three visibility settings. Per the platform's own publishing documentation, a script can be open source, protected or invite-only. Each one changes what you can check.
Open source shows everything: you can read the logic, see the strategy() properties, copy it, change the settings and rerun it. Every claim about an open-source strategy can be verified in about two minutes, which is why we only used open scripts for this grid.
Protected lets you add the script to a chart and run it, but you can't read the code. You can still open the Strategy Tester's properties tab and change commission, slippage and sizing if the author exposed them as inputs. You can't see whether the logic peeks at future data.
Invite-only gates the run itself, and without the author's approval you can't put it on a chart at all. Everything you know about it comes from screenshots and descriptions the seller chose to publish.
That gives a rough ladder of trust. Open source means you verify it yourself. Protected: test the outputs, not the logic. Invite-only: you're relying on the seller's word until access is granted, and even then you're in the protected situation.
The property set that decides every published figure
Six settings in the strategy() line, or in the Strategy Tester's properties tab, decide what a TradingView Pine script's report says. Change any one of them and the same code produces a different equity curve.
- Initial capital. TradingView's default is 1,000,000 in the chart's currency. A strategy trading one share of SPY against a million in the account will show a drawdown of a fraction of a percent, whatever the logic does.
- Order size. The default is a fixed quantity of 1 contract or share. The seven scripts here use 10% of equity, which is more realistic, but it also shrinks every return and every drawdown roughly tenfold compared with putting the whole account in.
- Commission. Default is zero.
- Slippage. Default is zero ticks.
- Pyramiding. Default allows one entry in a direction. Raise it and a trend-following script can stack positions, which inflates both wins and drawdowns.
- Recalculation. "On every tick" and "After order is filled" change when the script runs. On historical bars there are no ticks, so a script that recalculates on every tick behaves one way in the backtest and another way live.
Which default flatters results most? Zero commission and zero slippage, by a distance. Capital and order size distort the scale of the numbers, but they don't usually turn a loser into a winner. Zero costs can. In our hourly BTC-USD run, the MACD crossover showed a profit factor of 1.02 and a net gain of 0.69% at zero cost. With 0.1% commission and one tick of slippage, the same 646 trades produced a profit factor of 0.72 and a net loss of 11.53%. That's 12.22 percentage points of difference from the cost line alone, on 10% sizing.
One more thing worth knowing about "one tick". A tick is the instrument's minimum price step, not a percentage. On SPY that's one cent on a price in the hundreds, so one tick of slippage is close to nothing. Strategy Arena's own page found that on BTCUSDT it works out to under 0.04 basis points per fill. In practice, the 0.1% commission does almost all the work in this property set. If you trade a market with a wide spread, one tick will understate your real friction badly. Our slippage glossary entry explains how to set a more honest figure.
How we tested: the methodology behind the grid
Here's the test setup, so you can rerun it or argue with it.
The code. We ported each of the seven scripts from Pine to Python, rule for rule, and ran them through our own bar-by-bar simulator that copies TradingView's default broker emulator behaviour. Signals are evaluated on the bar close. Market orders fill at the next bar's open, plus one tick against you. Commission is 0.1% of order value on both entry and exit. Position size is 10% of current equity, calculated on the signal bar's close. Pyramiding is off. RSI and ATR use Wilder's smoothing, as Pine's ta.rsi and ta.atr do. The ATR breakout's stop is fixed at two ATR below the signal close and fills at the stop price, or at the open if the bar gaps through it.
The data. Daily bars from Yahoo Finance for SPY, QQQ, IWM, GLD and BTC-USD, from 2 January 2015 to 31 October 2025. That's 2,725 bars per ETF and 3,956 bars for BTC-USD, which trades every day. Prices are split-adjusted but not dividend-adjusted, which matches TradingView's default chart setting. Hourly bars came from the same source for SPY and QQQ (7 January 2024 to 13 November 2026, about 5,000 bars each after a 20-day warm-up) and BTC-USD (6 December 2024 to 15 November 2026, about 17,000 bars).
The runs. Seven strategies across eight instrument and timeframe pairs is 56 runs. Every one was repeated with commission and slippage at zero, for 112 in total. No parameter was changed and no run was dropped.
What counts as a trade. Win rate and profit factor use closed trades only. If a position was still open on the last bar, it's marked at that bar's close and included in net return, but not in the trade count. That matters a lot for the ATR breakout, as you'll see.
The limits. This is a faithful port, not a run inside TradingView itself. Indicator seeding on the first bars, data-vendor differences and the exact fill model can move individual trades. A one-trade difference on a strategy with 9 trades is a big deal, while on a strategy with 120 it isn't. Our data and the script are saved with this post's working files, and you can check any single row by pasting the original Pine into TradingView on the same symbol and dates. For the step-by-step version of that process, see how to backtest a TradingView indicator.
A note on reading backtests in general. US futures regulators require a specific warning on hypothetical results for a reason. NFA's Compliance Rule 2-29 makes firms state that hypothetical performance results "have many inherent limitations" and are "generally prepared with the benefit of hindsight." The SEC's investor site also keeps a plain-English glossary entry on back-testing. Everything below is hypothetical, on past data, and isn't a recommendation to trade any of it.
The grid: seven TradingView Pine scripts on daily bars, costs included
This is the full daily result with the declared property set: 10% of equity per trade, 0.1% commission, one tick of slippage. Net return is on the 10,000 starting capital. For scale, over the same window the four ETFs rose by 107% (IWM) to 511% (QQQ) on price alone, and BTC-USD rose by roughly 34,700%.
| Strategy | Instrument | Closed trades | Win rate % | Profit factor | Net return % | Max drawdown % |
|---|---|---|---|---|---|---|
| RSI mean reversion | BTC-USD | 19 | 78.9 | 4.45 | 26.41 | 9.41 |
| RSI mean reversion | GLD | 8 | 75.0 | 4.05 | 1.70 | 1.51 |
| RSI mean reversion | IWM | 10 | 60.0 | 3.76 | 4.07 | 3.55 |
| RSI mean reversion | QQQ | 11 | 90.9 | 5.40 | 6.71 | 3.14 |
| RSI mean reversion | SPY | 9 | 77.8 | 14.42 | 6.18 | 2.91 |
| EMA ribbon 8/21/55 | BTC-USD | 59 | 42.4 | 4.66 | 136.78 | 15.89 |
| EMA ribbon 8/21/55 | GLD | 48 | 31.2 | 1.55 | 5.69 | 2.61 |
| EMA ribbon 8/21/55 | IWM | 56 | 30.4 | 0.74 | -2.06 | 4.50 |
| EMA ribbon 8/21/55 | QQQ | 49 | 40.8 | 1.97 | 10.12 | 2.76 |
| EMA ribbon 8/21/55 | SPY | 49 | 42.9 | 1.70 | 5.11 | 1.82 |
| Bollinger bounce | BTC-USD | 38 | 55.3 | 1.26 | 6.51 | 15.55 |
| Bollinger bounce | GLD | 30 | 76.7 | 4.36 | 7.61 | 1.40 |
| Bollinger bounce | IWM | 34 | 76.5 | 1.79 | 6.40 | 4.27 |
| Bollinger bounce | QQQ | 26 | 80.8 | 3.73 | 10.61 | 4.26 |
| Bollinger bounce | SPY | 28 | 89.3 | 4.73 | 9.35 | 2.96 |
| MACD crossover | BTC-USD | 130 | 43.8 | 2.68 | 117.86 | 6.80 |
| MACD crossover | GLD | 114 | 36.8 | 1.38 | 4.70 | 1.83 |
| MACD crossover | IWM | 114 | 39.5 | 1.20 | 3.18 | 3.52 |
| MACD crossover | QQQ | 105 | 48.6 | 1.46 | 6.49 | 2.83 |
| MACD crossover | SPY | 121 | 41.3 | 1.31 | 3.64 | 1.72 |
| SuperTrend filter | BTC-USD | 57 | 49.1 | 3.11 | 95.15 | 9.62 |
| SuperTrend filter | GLD | 51 | 39.2 | 1.68 | 5.63 | 2.32 |
| SuperTrend filter | IWM | 44 | 43.2 | 1.00 | 0.82 | 4.61 |
| SuperTrend filter | QQQ | 46 | 50.0 | 2.14 | 9.78 | 2.55 |
| SuperTrend filter | SPY | 48 | 47.9 | 1.88 | 6.28 | 1.89 |
| Stochastic RSI | BTC-USD | 79 | 54.4 | 1.52 | 21.96 | 7.87 |
| Stochastic RSI | GLD | 59 | 64.4 | 2.53 | 7.89 | 1.58 |
| Stochastic RSI | IWM | 61 | 72.1 | 1.60 | 6.25 | 4.55 |
| Stochastic RSI | QQQ | 51 | 70.6 | 2.09 | 7.74 | 4.09 |
| Stochastic RSI | SPY | 53 | 77.4 | 1.81 | 4.51 | 2.91 |
| ATR breakout, fixed stop | BTC-USD | 3 | 0.0 | 0.00 | 4,096.21 | 74.37 |
| ATR breakout, fixed stop | GLD | 6 | 0.0 | 0.00 | 22.19 | 3.68 |
| ATR breakout, fixed stop | IWM | 2 | 0.0 | 0.00 | 4.66 | 5.12 |
| ATR breakout, fixed stop | QQQ | 3 | 0.0 | 0.00 | 45.21 | 10.27 |
| ATR breakout, fixed stop | SPY | 0 | – | – | 22.04 | 5.13 |
A few things jump out when we compared the rows.
Almost everything is positive, and almost everything is small. Only one daily run lost money: the EMA ribbon on IWM, at minus 2.06% with a profit factor of 0.74. SuperTrend on IWM broke even at a profit factor of 1.00. The rest made something, but at 10% sizing, "something" means single digits on the ETFs. The Bollinger bounce on SPY, one of the stronger rows, made 9.35% in almost 11 years while SPY itself rose 232%. Even multiplied by ten, as a rough guide to full sizing, that's well short of holding the ETF. These are long-only rules on markets that mostly went up, so a positive number is the minimum you'd expect, not proof of an edge.
High win rates come with tiny samples. RSI mean reversion won 90.91% of its trades on QQQ and posted a profit factor of 14.42 on SPY. It also made between 8 and 19 trades per instrument in nearly 11 years. That's roughly one trade a year. You can't tell skill from luck on 9 trades, and Strategy Arena's judge reached the same verdict on BTCUSDT: too few trades to judge.
Win rate and profit factor point in different directions. The Bollinger bounce won 89.29% of its SPY trades. The EMA ribbon won 42.86% on the same instrument, yet both made money. Trend rules lose often and win big. Mean-reversion rules win often and occasionally sit through long drawdowns. A page that quotes a win rate without a profit factor and a trade count is telling you one-third of the story.
The ATR breakout isn't really a trading strategy. Look at its row: zero to six closed trades per instrument, and every closed trade is a loss, so the win rate is 0%. Yet it shows the highest net returns in the table, including 4,096% on BTC-USD with a 74.37% drawdown. So what's happening? The script's only exit is a fixed stop two ATR below the signal close. There's no target and no time exit, so once a trade starts in a rising market and price runs away from the stop, it never closes. All the return comes from one open position that turned into buy-and-hold. Every trade that did close was, by construction, a stop-out, and on SPY the script entered once and never left. That's not a breakout system. It's a delayed buy-and-hold with a stop that only matters if you're early.
The BTC-USD drawdown also shows the sizing trap. The position was 10% of equity when it opened. As bitcoin rose, that slice grew until it was almost the whole account, so the account then took the full force of bitcoin's later falls.
The same grid at zero cost: what friction really takes
Here are the daily results again, averaged across the five instruments, with costs on and costs off. "Friction" is the gap in percentage points between the two runs.
| Strategy | Closed trades, all 5 instruments | Avg net % with costs | Avg net % at zero cost | Avg friction, points |
|---|---|---|---|---|
| RSI mean reversion | 57 | 9.01 | 9.29 | 0.27 |
| EMA ribbon 8/21/55 | 261 | 31.13 | 32.63 | 1.50 |
| Bollinger bounce | 156 | 8.10 | 8.81 | 0.71 |
| MACD crossover | 584 | 27.17 | 30.39 | 3.22 |
| SuperTrend filter | 246 | 23.53 | 24.86 | 1.33 |
| Stochastic RSI | 303 | 9.67 | 11.09 | 1.42 |
| ATR breakout, fixed stop | 14 | 838.06 | 838.65 | 0.58 |
On daily bars, costs are a rounding error for most of these rules. RSI lost about a quarter of a point over 11 years. The MACD crossover lost the most, 3.22 points on average, because it traded the most: 584 closed trades across the five instruments. Per trade, the drag was close to identical for every strategy, between 0.02 and 0.03 points on the account. Costs hurt in proportion to how often you trade, and that's the whole lesson, and the hourly test shows it at full strength.
Hourly bars: where the cost line becomes decisive
We ran the same seven scripts, unchanged, on hourly bars. They used the same property set and the same 10% sizing. This is the table that matters for anyone who wants to run a TradingView Pine script on an intraday chart.
| Strategy | Instrument | Closed trades | Net % with costs | Net % at zero cost | Friction, points | PF with costs | PF at zero cost |
|---|---|---|---|---|---|---|---|
| RSI mean reversion | BTC-USD | 67 | -2.58 | -1.26 | 1.32 | 0.90 | 1.02 |
| RSI mean reversion | QQQ | 25 | 3.28 | 3.82 | 0.54 | 3.39 | 3.79 |
| RSI mean reversion | SPY | 23 | 2.58 | 3.08 | 0.49 | 3.35 | 3.97 |
| EMA ribbon 8/21/55 | BTC-USD | 269 | -5.96 | -0.77 | 5.20 | 0.72 | 0.96 |
| EMA ribbon 8/21/55 | QQQ | 89 | 1.12 | 2.98 | 1.85 | 1.16 | 1.51 |
| EMA ribbon 8/21/55 | SPY | 92 | 0.18 | 2.07 | 1.89 | 1.03 | 1.46 |
| Bollinger bounce | BTC-USD | 188 | -5.81 | -2.20 | 3.62 | 0.77 | 0.94 |
| Bollinger bounce | QQQ | 54 | 2.01 | 3.14 | 1.13 | 1.44 | 1.74 |
| Bollinger bounce | SPY | 54 | 2.35 | 3.50 | 1.14 | 1.73 | 2.22 |
| MACD crossover | BTC-USD | 646 | -11.53 | 0.69 | 12.22 | 0.72 | 1.02 |
| MACD crossover | QQQ | 181 | -0.95 | 2.77 | 3.72 | 0.92 | 1.28 |
| MACD crossover | SPY | 183 | -1.63 | 2.10 | 3.73 | 0.81 | 1.32 |
| SuperTrend filter | BTC-USD | 242 | -8.06 | -3.49 | 4.57 | 0.69 | 0.85 |
| SuperTrend filter | QQQ | 90 | 0.49 | 2.35 | 1.86 | 1.05 | 1.29 |
| SuperTrend filter | SPY | 83 | 0.54 | 2.25 | 1.71 | 1.09 | 1.46 |
| Stochastic RSI | BTC-USD | 345 | -9.71 | -3.27 | 6.45 | 0.68 | 0.88 |
| Stochastic RSI | QQQ | 106 | 1.03 | 3.25 | 2.22 | 1.12 | 1.44 |
| Stochastic RSI | SPY | 104 | 0.80 | 2.97 | 2.17 | 1.17 | 1.79 |
| ATR breakout, fixed stop | BTC-USD | 60 | -8.59 | -7.49 | 1.11 | 0.00 | 0.00 |
| ATR breakout, fixed stop | QQQ | 0 | 6.94 | 6.95 | 0.01 | – | – |
| ATR breakout, fixed stop | SPY | 0 | 5.77 | 5.78 | 0.01 | – | – |
On SPY and QQQ, the MACD crossover made 2.10% and 2.77% at zero cost. With costs on, both turned into losses: minus 1.63% and minus 0.95%. Profit factor dropped from about 1.3 to below 1.0. The EMA ribbon on SPY kept just 0.18% of a 2.07% gross gain. Stochastic RSI kept less than a third of its gross on both ETFs.
BTC-USD is harsher: with costs, all seven lost money on hourly bars. At zero cost, only the MACD crossover was positive, and only just: 0.69%, from 646 trades. Its 12.22-point friction bill is more than the strategy ever made. That's also the honest answer to "which default flatters results most": on this test, zero commission was worth more than the entire gross edge of the busiest script.
Why is BTC-USD worse than the ETFs even at zero cost? We can only describe what the data shows, not prove a cause. Over this window, hourly bitcoin chopped in a way that cut short trend entries and punished buy-the-dip entries, and it trades around the clock, so the scripts traded 2 to 4 times as often as on the ETFs.
Which of the seven are most exposed to costs by construction
You can predict a script's cost exposure from its exit rule before you run anything. The question is simple, and it's how easily the exit flips.
The MACD crossover is the most exposed. It enters on one crossover and exits on the opposite one. In a flat market, MACD and its signal line cross back and forth constantly, and each pair of crosses is a round trip. On daily bars it made 105 to 130 trades per instrument, roughly twice as many as anything else.
The EMA ribbon and SuperTrend filter come next. Both are state rules: in when the trend is up, out when it isn't. Neither needs a fresh crossover to re-enter, so both whipsaw in sideways markets. The Stochastic RSI sits in the same band. Its zone filters (K below 20 to enter, above 80 to exit) look restrictive, but the oscillator moves fast, and the script traded 51 to 79 times per instrument on daily bars.
The RSI mean reversion and Bollinger bounce are the least exposed. Their exits sit at the opposite extreme from their entries, so trades are rare and long. That protects them from friction, but it leaves them with tiny samples, which is a different problem. The ATR breakout barely trades at all on daily bars. On hourly BTC-USD it made 60 trades, and all 60 were stop-outs.
A pattern held across our data. The two ETF runs that costs flipped from profit to loss, MACD on hourly SPY and QQQ, both traded more than 60 times a year. The slower runs that kept their gains traded far less. We've seen the same thing at a much larger scale in our SuperTrend backtest full results, a grid of 2,160 runs where the popular 10, 3 setting was wiped out on 1-, 3- and 5-minute charts because it flipped too often for the trading cost to survive. If you want the zero-cost comparison explained on its own, our piece on zero-cost vs real-cost backtests walks through it.
The repainting check: a separate problem from costs
Costs explain why an honest report can still lose money. Repainting explains why a dishonest-looking chart can show a perfect record. These are different problems, and a page that covers one usually ignores the other.
An indicator repaints when the signal you see on a past bar isn't the signal that was on screen while that bar was forming. The usual causes are pulling higher-timeframe data with lookahead switched on, using the current bar's values before it closes, or pivot logic that places a marker several bars after the fact. On a finished chart, a repainting indicator can look as if it caught every top and bottom, when in real time it didn't.
The seven scripts in this test are low-risk on this front. None of them request data from another timeframe, and all of them act on values from the closed bar. Their backtests reflect what you'd have seen live, apart from fills. Popular community indicators are often a different story, and that's where the check matters. The quickest way to run it yourself is in our guide on how to test any TradingView indicator for repainting, which uses bar replay and real-time screenshots to compare what the script showed live against what it shows afterwards.
One overlap is worth knowing. If a strategy is set to recalculate on every tick, it can enter and exit inside a bar in live trading, while the historical backtest only ever saw closed bars. That isn't repainting in the strict sense, but the effect is similar: live results drift away from the report. Check that setting before you trust any strategy report.
What to do with a protected or invite-only script you can't read
You won't always have the source, but when you don't, three checks still work.
First, open the Strategy Tester's properties tab and set commission and slippage to realistic values yourself. If the author locked them, or the script is an indicator with no strategy report at all, note that, because it tells you something.
Second, run the repainting check on its signals in real time. Screenshot every signal as it appears, then compare a day later, since you don't need source code to see whether arrows move.
Third, forward-track it. Log every alert for a few weeks, with time and price, and compare those logged signals with what the chart claims afterwards. It's slow, but it's the only performance record you'll have that nobody curated.
The one question you can't answer without source is whether the logic uses information it shouldn't have had at the time. Lookahead in a higher-timeframe request, for example, can produce a backtest that no live account could ever match. Outputs can hint at it, but only the code can rule it out. That's why our view is simple: a performance claim on a closed script is a claim, not evidence, until you've watched it work forward.
What we'd take from this grid
None of the seven is a finished trading system, and the grid isn't a ranking, but what it does show is how much the context changes the answer. The same MACD crossover is a small winner on daily SPY and a loser on hourly SPY, without a single line of code changing. The same RSI rule shows a 90% win rate and still can't be judged, because it traded about once a year. And the script with the highest return in the table had a 0% win rate on its closed trades.
When you read any TradingView Pine script's report, check four things before the return figure: the trade count, the commission and slippage settings, the order size, and whether a big open position is carrying the result. Those four explained almost every surprise in our 112 runs.
At Quantzee we build analytical indicators for TradingView, and this kind of test is how we look at our own tools too. If you'd like to see how a structured toolkit handles signals and confirmation, start with the glossary and testing guides linked above, and treat every number on any page, including this one, as something to check, not something to trust.
