Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Relative Volume & RSI Pop

A Pine Script v4 strategy built on RSI (price, 14), Crossover (vrsi, 70) and Crossunder (vrsi, 35). It has 4 order rules, 2 entries among them, and trades long and short with the default settings. Exits wait for a signal; there is no stop loss. Each trade is one contract and pays no commission. 5 settings; defaults include RSI Period 14, RSI buy 70 and RSI short 35.

Generated from the script's code by a template: every clause is a fact read from the source. Not written by a person or a model, and not taken from the author's description.

Does Relative Volume & RSI Pop repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 7 of 7 trades.
How did Relative Volume & RSI Pop do on BTCUSDT 1D with default settings?
+38.88%
From 26 Jan 2024 to 21 Oct 2026, over 17 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can Relative Volume & RSI Pop be converted to Pine Script v5?
Yes
The upgrade takes 1 step, from v4; each was run before and after on the same candles with identical results, and the v5 script can be downloaded below.
Does Relative Volume & RSI Pop use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Relative Volume & RSI Pop run in Zeal Terminal?
Yes
It compiles in 9 ms and runs 1,000 bars in 25 ms, in the browser.

BTCUSDT · 1D · default settings

  • RSI
  • Upper Band
  • Middle Band
  • Lower Band
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (5)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctRSI$138,885$202,527Equity from $100,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. Lines are what the script plots.
Net profit
+38.88%
$38,879.20
Buy and hold
+102.5%
same period
Closed trades
17
8 won · 9 lost
Profitable
47.1%
of closed trades
Profit factor
3.35
gross profit ÷ gross loss
Max drawdown
5.67%
−$5,674.02

One run with the author's default settings, $100,000 starting capital, commission as the script sets it. A single backtest says little about future results and is not a recommendation. Backtests are simulations on historical data and are not investment advice.

Review

What a careful reader of this script would point out, found by checking the source and the backtest.

  • Check

    No stop loss

    Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.

  • Check

    No commission

    The backtest assumes free trading. Results on any real exchange will be lower.

  • Note

    No slippage

    Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.

  • Note

    Uses an argument v6 removed

    when = on line 33, 37. The upgraded version below moves each call inside an if block.

  • Note

    Uses transp =, which v5 removed line 19

    transp = on line 19. v5 folds the transparency into the colour with color.new(c, transp).

Upgrade and export

Written in Pine Script v4. The upgrade to v5 takes 1 step, one per version, each applied to the result of the one before. A last clean-v5 pass then types the settings and moves when = into if blocks, which v6 requires. Every step runs before and after on the same candles in Zeal Terminal's engine; a step whose results differ is shown but not offered as a download. Upgrades preserve behaviour: bugs are fixed in the Review, never silently here.

  • Upgrading to v5 renames rsi → ta.rsi, crossover → ta.crossover, crossunder → ta.crossunder, sma → ta.sma.
  • 2 strategy calls use the when = argument (line 33, 37). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

Same 17 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 5: //@version=4 → //@version=5
  • Line 12: rsi → ta.rsi
  • Line 13: crossover → ta.crossover
  • Line 14: crossunder → ta.crossunder
  • Line 19: transp = 90 → color.new(color.purple, 90)
  • Line 22: sma → ta.sma
⋯//Drawdown is typically low as it exits out of the trade once the RSI returns back to "normal levels".-//@version=4+//@version=5strategy(title="Relative Volume & RSI Pop", shorttitle="VOL & RSI Pop", overlay=false, precision=2, margin_long=100, margin_short=100)⋯price = close-vrsi = rsi(price, RSIlength)+vrsi = ta.rsi(price, RSIlength)-RSIco = crossover(vrsi, RSItop)+RSIco = ta.crossover(vrsi, RSItop)-RSIcu = crossunder(vrsi, RSIbottom)+RSIcu = ta.crossunder(vrsi, RSIbottom)plot(vrsi, "RSI", color=color.purple)⋯band0 = hline(30, "Lower Band", color=#C0C0C0)-fill(band1, band0, color=color.purple, transp=90, title="Background")+fill(band1, band0, color=color.new(color.purple, 90), title="Background")//RELATIVE VOLUMERVOLlen = input(14, minval=1, title="RV Period")-av = sma(volume, RVOLlen)+av = ta.sma(volume, RVOLlen)RVOL = volume / av⋯

Clean v5

VerifiedDownload the v5 script

Same 17 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 8: input() → input.int()
  • Line 9: input() → input.int()
  • Line 10: input() → input.int()
  • Line 21: input() → input.int()
  • Line 24: input() → input.float()
  • Line 33: when = CloseLong → if block
  • Line 37: when = CloseShort → if block
⋯//RSI-RSIlength = input(14, title="RSI Period")+RSIlength = input.int(14, title="RSI Period")-RSItop = input(70, title="RSI buy", minval= 69, maxval=100)+RSItop = input.int(70, title="RSI buy", minval= 69, maxval=100)-RSIbottom = input(35, title="RSI short", minval= 0, maxval=35)+RSIbottom = input.int(35, title="RSI short", minval= 0, maxval=35)price = close⋯//RELATIVE VOLUME-RVOLlen = input(14, minval=1, title="RV Period")+RVOLlen = input.int(14, minval=1, title="RV Period")av = ta.sma(volume, RVOLlen)RVOL = volume / av-RVOLthreshold = input(1.5,title="RV Threshold", minval=0.5, maxval=10)+RVOLthreshold = input.float(1.5,title="RV Threshold", minval=0.5, maxval=10)//TRADE TRIGGERS⋯    -strategy.close("Long", when = CloseLong)    +if CloseLong+    strategy.close("Long")    if (ShortCondition)⋯    -strategy.close("Short", when = CloseShort)+if CloseShort+    strategy.close("Short")

Does it run in Pine Script v6?

No

The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 17 before, 17 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯//Drawdown is typically low as it exits out of the trade once the RSI returns back to "normal levels".-//@version=5+//@version=6strategy(title="Relative Volume & RSI Pop", shorttitle="VOL & RSI Pop", overlay=false, precision=2, margin_long=100, margin_short=100)⋯

Settings

Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.

SettingDefaultType and rangeFeeds
RSI Period14intvrsi
RSI buy70int · min 69 · max 100RSIco
RSI short35int · min 0 · max 35RSIcu
RV Period14int · min 1av
RV Threshold1.5float · min 0.5 · max 10LongCondition ShortCondition

What it calculates

  • RSI (rsi, ta.rsi in v5)price, RSI Period (14)vrsi · line 12
  • Crossover (crossover, ta.crossover in v5)vrsi, RSI buy (70)RSIco · line 13
  • Crossunder (crossunder, ta.crossunder in v5)vrsi, RSI short (35)RSIcu · line 14
  • SMA (sma, ta.sma in v5)volume, RV Period (14)av · line 22

Signal flow

How price data and settings reach the orders. Each box is a name in the script, or several computed the same way; each arrow is a value one of them reads. Hover a box for its members.

RSIlengthRSI Periodsetting · 14RSItopRSI buysetting · 70RSIbottomRSI shortsetting · 35volumevolumeprice dataRVOLlenRV Periodsetting · 14closecloseprice dataRVOLthresholdRV Thresholdsetting · 1.5vrsiRSI→ vrsiRSIcoCrossover→ RSIcoRSIcuCrossunder→ RSIcuavSMA→ avpricepricevalueRVOLRVOLvalueLongConditionLongConditionconditionCloseLongCloseLongconditionShortConditionShortConditionconditionCloseShortCloseShortconditionentry:LongOpen Longstrategy.entryclose:LongClose Longstrategy.closeentry:ShortOpen Shortstrategy.entryclose:ShortClose Shortstrategy.closeplot:15RSIplothline:16hlinehlinehline:17hlinehlinehline:18hlinehlinefill:BackgroundBackgroundfill

Order rules

OrderFires whenBy defaultLine
Open Long long(LongCondition)On31
Close LongCloseLongvrsi < 69On33
Open Short short(ShortCondition)On35
Close ShortCloseShortvrsi > 35On37

Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.

Does it repaint?

No

No repainting patterns in the source, and the live replay matched history.

7/7trades identical when replayed liveThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, four per bar, and compared with the historical run. Orders are decided once per closed bar, so nothing can change mid-bar.
  • ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • ClearIntrabar recalculationNo varip, calc_on_every_tick or realtime-only state. Orders are decided once per closed bar.
  • ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.

The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.

Other markets

The same script with default settings on 8 Binance markets. Each row is a separate backtest over the most recent 1,000 bars.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D+38.9%+102.5%1747%3.355.7%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+13.5%+5.5%1926%3.144.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+1.2%+9.8%1443%2.600.4%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.5%+8.4%2241%3.340.1%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.0%+16.7%1540%0.810.1%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.0%+21.5%1828%2.050.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.1%+148.3%2227%1.250.4%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.0%+17.1%1822%1.150.1%8 May 2026 – 21 Oct 2026

Backtests are simulations on historical data and are not investment advice.

Settings heatmap

Two settings that feed the entry signal, moved around their defaults. The best in-sample pair (RSI buy 70, RSI short 18) made +16.9% before 26 Dec 2025 and −4.8% after it, worse than the defaults' +25.0% after. Tuning on the past did not carry forward. 73% of the 64 combinations made money in-sample and 75% out-of-sample.

Before 26 Dec 2025 · in-sample
RSI short ↓ · RSI buy →35424960708498119
18+16%+16%+16%+16%+17%+11%0%0%
21+16%+16%+16%+16%+17%+11%0%0%
25+6%+6%+6%+6%+7%+1%−10%−10%
30+0%+0%+0%+0%+1%−4%−16%−16%
35+13%+13%+13%+13%+14%+8%−3%−3%
42+13%+13%+13%+13%+14%+8%−3%−3%
49+13%+13%+13%+13%+14%+8%−3%−3%
60+13%+13%+13%+13%+14%+8%−3%−3%
From 26 Dec 2025 · out-of-sample
RSI short ↓ · RSI buy →35424960708498119
18−5%−5%−5%−5%−5%−10%−9%−9%
21−2%−2%−2%−2%−2%−7%−6%−6%
25+11%+11%+11%+11%+11%+6%+7%+7%
30+17%+17%+17%+17%+17%+11%+12%+12%
35+25%+25%+25%+25%+25%+20%+20%+20%
42+25%+25%+25%+25%+25%+20%+20%+20%
49+25%+25%+25%+25%+25%+20%+20%+20%
60+25%+25%+25%+25%+25%+20%+20%+20%

Net P&L of trades opened in each period, as a share of starting capital. marks the defaults and the best in-sample cell. Hover a cell for its trade count. Backtests are simulations on historical data and are not investment advice.

The trades

By market direction

At entry, last 90 barsTradesWonP&L
Rising market450%$16,268.10
Sideways market850%$7,415.00
Falling market540%$15,196.20

Rising and falling mean the market moved more than 15% over the 90 bars before entry.

How bad could the drawdown be?

10.1%

The 95th percentile of the worst drawdown when the same 17 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 4.1% to 10.1%; the tick is what actually happened, 4.5%. Order luck alone moves it this much.

0%12%
All 17 trades
SideEntryExitBarsP&L
short2 May 2024 58,365.003 May 2024 59,060.601−$695.63
short5 Jul 2024 57,050.007 Jul 2024 58,230.102−$1,180.11
short7 Sep 2024 53,963.008 Sep 2024 54,160.901−$197.89
long30 Oct 2024 72,736.401 Nov 2024 70,292.002−$2,444.40
long7 Nov 2024 75,572.0026 Nov 2024 93,010.0019$17,438.00
short25 Feb 2025 91,552.903 Mar 2025 94,270.006−$2,717.11
long9 May 2025 103,262.0017 May 2025 103,464.008$202.29
long11 Jul 2025 116,010.0016 Jul 2025 117,758.005$1,748.07
short5 Nov 2025 101,497.006 Nov 2025 103,885.001−$2,387.93
short15 Nov 2025 94,594.0027 Nov 2025 90,484.0012$4,109.99
long15 Jan 2026 96,951.8016 Jan 2026 95,604.801−$1,346.97
short30 Jan 2026 84,650.2014 Feb 2026 68,854.0015$15,796.20
short24 Feb 2026 64,656.0026 Feb 2026 67,988.002−$3,332.03
short2 Jun 2026 71,408.9014 Jun 2026 64,458.0012$6,950.89
short25 Jun 2026 61,078.002 Jul 2026 60,024.007$1,054.00
long20 Aug 2026 69,334.802 Sep 2026 77,439.0013$8,104.23
long22 Sep 2026 86,620.0024 Sep 2026 84,397.602−$2,222.41

Similar scripts

Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.

ScriptSharesTypeNetTradesMax drawdown
Relative Volume & RSI Pop this page—v4 strategy+38.9%175.7%
SRJ RSI Outperformer Strategy by Sapt_Jashrsi smav5 strategy+0.6%82.4%
RSI SMA Crossover Strategy by reeesrsi smav5 strategy+39.8%4230.8%
Short In Downtrend Below MA100 (Coinrule) by Coinrulesma rsiv4 strategy−34.5%9945.4%
Simple RSI and SMA Long and Short (by Coinrule) by Coinrulersi smav5 strategy−3.0%217.7%
Maximized Moving Average Crossing (by Coinrule) by Coinrulesma rsiv4 strategy−6.6%913.3%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 9 msYes 1,000 bars in 25 msNot measured
PineTSNo v5 and v6 only—Not measured

“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report. PineTS runs Pine Script v5 and v6 only.

Source

Copied verbatim from the author's published script, with its licence header intact. The author may have updated the original since this snapshot.

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © gary_trades//This script is a basic concept to catch breakout moves utilising a spike in relative volume when the RSI is high (for longs) or when the RSI is low (for shorts).//Drawdown is typically low as it exits out of the trade once the RSI returns back to "normal levels".//@version=4strategy(title="Relative Volume & RSI Pop", shorttitle="VOL & RSI Pop", overlay=false, precision=2, margin_long=100, margin_short=100)//RSIRSIlength = input(14, title="RSI Period")RSItop = input(70, title="RSI buy", minval= 69, maxval=100)RSIbottom = input(35, title="RSI short", minval= 0, maxval=35)price = closevrsi = rsi(price, RSIlength)RSIco = crossover(vrsi, RSItop)RSIcu = crossunder(vrsi, RSIbottom)plot(vrsi, "RSI", color=color.purple)band1 = hline(70, "Upper Band", color=#C0C0C0)bandm = hline(50, "Middle Band", color=color.new(#C0C0C0, 50))band0 = hline(30, "Lower Band", color=#C0C0C0)fill(band1, band0, color=color.purple, transp=90, title="Background")//RELATIVE VOLUMERVOLlen = input(14, minval=1, title="RV Period")av = sma(volume, RVOLlen)RVOL = volume / avRVOLthreshold = input(1.5,title="RV Threshold", minval=0.5, maxval=10)//TRADE TRIGGERSLongCondition = RSIco and RVOL > RVOLthresholdCloseLong = vrsi < 69ShortCondition = RSIcu and RVOL > RVOLthresholdCloseShort = vrsi > 35if (LongCondition)    strategy.entry("Long", strategy.long)    strategy.close("Long", when = CloseLong)    if (ShortCondition)    strategy.entry("Short", strategy.short)    strategy.close("Short", when = CloseShort)