Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

MACD, RSI, & RVOL Strategy

A Pine Script v4 strategy built on RSI (price, 14), Crossover (vrsi, 30) and Crossunder (vrsi, 70). It has 2 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 commits 100000 in cash and pays no commission. 7 settings; defaults include Length 14, Over Sold 30 and Over Bought 70.

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 MACD, RSI, & RVOL Strategy repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did MACD, RSI, & RVOL Strategy do on BTCUSDT 1D with default settings?
+32.59%
From 26 Jan 2024 to 21 Oct 2026, over 1 closed trade, against +102.5% for buy and hold. A backtest, not investment advice.
Can MACD, RSI, & RVOL Strategy 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 MACD, RSI, & RVOL Strategy use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does MACD, RSI, & RVOL Strategy run in Zeal Terminal?
Yes
It compiles in 12 ms and runs 1,000 bars in 27 ms, in the browser.

BTCUSDT · 1D · default settings

  • Crossover
  • Crossunder
  • EMA
  • EMA
  • SMA
  • 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 (7)
0.0050,000100,000AprJulOct2025AprJulOct2026AprJulOctRSI$132,593$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. The script plots nothing itself; the lines and the lower pane are its own calculations, drawn for reference.
Net profit
+32.59%
$32,594.10
Buy and hold
+102.5%
same period
Closed trades
1
1 won · 0 lost
Profitable
100.0%
of closed trades
Profit factor
—
gross profit ÷ gross loss
Max drawdown
1.53%
−$1,529.65

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.

  • Likely bug

    crossover(delta, 0) ignores the settings line 25

    Line 25 hard-codes 0 where line 13 uses “Over Sold”. Changing those settings moves one band but not this one.

    crossover(delta, 0)crossover(delta, overSold)
  • Likely bug

    crossover(RVOL, 2) ignores the settings line 25

    Line 25 hard-codes 2 where line 13 uses “Over Sold”. Changing those settings moves one band but not this one.

    crossover(RVOL, 2)crossover(RVOL, overSold)
  • Likely bug

    crossover(delta, 0) ignores the settings line 25

    Line 25 hard-codes 0 where line 13 uses “Over Sold”. Changing those settings moves one band but not this one.

    crossover(delta, 0)crossover(delta, overSold)
  • Likely bug

    crossover(RVOL, 2) ignores the settings line 25

    Line 25 hard-codes 2 where line 13 uses “Over Sold”. Changing those settings moves one band but not this one.

    crossover(RVOL, 2)crossover(RVOL, overSold)
  • Likely bug

    crossunder(delta, 0) ignores the settings line 28

    Line 28 hard-codes 0 where line 14 uses “Over Bought”. Changing those settings moves one band but not this one.

    crossunder(delta, 0)crossunder(delta, overBought)
  • Likely bug

    crossunder(RVOL, 5) ignores the settings line 28

    Line 28 hard-codes 5 where line 14 uses “Over Bought”. Changing those settings moves one band but not this one.

    crossunder(RVOL, 5)crossunder(RVOL, overBought)
  • Likely bug

    crossunder(delta, 0) ignores the settings line 28

    Line 28 hard-codes 0 where line 14 uses “Over Bought”. Changing those settings moves one band but not this one.

    crossunder(delta, 0)crossunder(delta, overBought)
  • Likely bug

    crossunder(RVOL, 5) ignores the settings line 28

    Line 28 hard-codes 5 where line 14 uses “Over Bought”. Changing those settings moves one band but not this one.

    crossunder(RVOL, 5)crossunder(RVOL, overBought)
  • 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

    6 settings have no label

    In the settings dialog length (line 8), overSold (line 9), overBought (line 10), fastLength (line 15), slowlength (line 16), MACDLength (line 17) show an empty name. The labels on this page come from the variable names.

  • Note

    No slippage

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

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, ema → ta.ema, sma → ta.sma.

v4 → v5

Verified

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

  • Line 3: //@version=4 → //@version=5
  • Line 12: rsi → ta.rsi
  • Line 13: crossover → ta.crossover
  • Line 14: crossunder → ta.crossunder
  • Line 18: ema → ta.ema
  • Line 18: ema → ta.ema
10 more edits
  • Line 19: ema → ta.ema
  • Line 22: sma → ta.sma
  • Line 25: crossover → ta.crossover
  • Line 25: crossover → ta.crossover
  • Line 25: crossover → ta.crossover
  • Line 25: crossover → ta.crossover
  • Line 28: crossunder → ta.crossunder
  • Line 28: crossunder → ta.crossunder
  • Line 28: crossunder → ta.crossunder
  • Line 28: crossunder → ta.crossunder
⋯// © BobBarker42069-//@version=4+//@version=5strategy("MACD, RSI, & RVOL Strategy", overlay=true, max_bars_back=5000, ⋯price = close-vrsi = rsi(price, length)+vrsi = ta.rsi(price, length)-co = crossover(vrsi, overSold)+co = ta.crossover(vrsi, overSold)-cu = crossunder(vrsi, overBought)+cu = ta.crossunder(vrsi, overBought)fastLength = input(12)⋯MACDLength = input(9)-MACD = ema(close, fastLength) - ema(close, slowlength)+MACD = ta.ema(close, fastLength) - ta.ema(close, slowlength)-aMACD = ema(MACD, MACDLength)+aMACD = ta.ema(MACD, MACDLength)delta = MACD - aMACDRVOLlen = input(14, minval=1, title="RVOL Length")-av = sma(volume, RVOLlen)+av = ta.sma(volume, RVOLlen)RVOL = volume / avif (not na(vrsi)) -    if ((co and crossover(delta, 0)) or (co and crossover(RVOL, 2)) or (crossover(delta, 0) and crossover(RVOL, 2)))+    if ((co and ta.crossover(delta, 0)) or (co and ta.crossover(RVOL, 2)) or (ta.crossover(delta, 0) and ta.crossover(RVOL, 2)))        strategy.entry("MACD & RSI BUY Long", strategy.long, comment="BUY LONG")        -    if ((cu and crossunder(delta, 0)) or (cu and crossunder(RVOL, 5)) or (crossunder(delta, 0) and crossunder(RVOL, 5)))+    if ((cu and ta.crossunder(delta, 0)) or (cu and ta.crossunder(RVOL, 5)) or (ta.crossunder(delta, 0) and ta.crossunder(RVOL, 5)))        strategy.entry("MACD & RSI SELL Short", strategy.short, comment="SELL LONG")⋯

Clean v5

VerifiedDownload the v5 script

Same 1 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 15: input() → input.int()
  • Line 16: input() → input.int()
  • Line 17: input() → input.int()
  • Line 21: input() → input.int()
⋯strategy.risk.allow_entry_in(strategy.direction.long)-length = input( 14 )+length = input.int( 14 )-overSold = input( 30 )+overSold = input.int( 30 )-overBought = input( 70 )+overBought = input.int( 70 )price = close⋯cu = ta.crossunder(vrsi, overBought)-fastLength = input(12)+fastLength = input.int(12)-slowlength = input(26)+slowlength = input.int(26)-MACDLength = input(9)+MACDLength = input.int(9)MACD = ta.ema(close, fastLength) - ta.ema(close, slowlength)⋯delta = MACD - aMACD-RVOLlen = input(14, minval=1, title="RVOL Length")+RVOLlen = input.int(14, minval=1, title="RVOL Length")av = ta.sma(volume, RVOLlen)⋯

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: 1 before, 2 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.

⋯// © BobBarker42069-//@version=5+//@version=6strategy("MACD, RSI, & RVOL Strategy", overlay=true, max_bars_back=5000, ⋯

Settings

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

SettingDefaultType and rangeFeeds
Length (no label in the script)14intvrsi
Over Sold (no label in the script)30intco
Over Bought (no label in the script)70intcu
Fast Length (no label in the script)12intMACD
Slowlength (no label in the script)26intMACD
MACDLength (no label in the script)9intaMACD
RVOL Length14int · min 1av

What it calculates

  • RSI (rsi, ta.rsi in v5)price, Length (14)vrsi · line 12
  • Crossover (crossover, ta.crossover in v5)vrsi, Over Sold (30)co · line 13
  • Crossunder (crossunder, ta.crossunder in v5)vrsi, Over Bought (70)cu · line 14
  • EMA (ema, ta.ema in v5)close, Fast Length (12)MACD · line 18
  • EMA (ema, ta.ema in v5)MACD, MACDLength (9)aMACD · line 19
  • SMA (sma, ta.sma in v5)volume, RVOL Length (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.

lengthLengthsetting · 14overSoldOver Soldsetting · 30overBoughtOver Boughtsetting · 70closecloseprice datafastLengthFast Lengthsetting · 12slowlengthSlowlengthsetting · 26MACDLengthMACDLengthsetting · 9volumevolumeprice dataRVOLlenRVOL Lengthsetting · 14vrsiRSI→ vrsicoCrossover→ cocuCrossunder→ cuMACDEMA→ MACDaMACDEMA→ aMACDavSMA→ avpricepricevaluedeltadeltavalueRVOLRVOLvalueentry:MACD & RSI BUY LongOpen MACD & RSI BUY Longstrategy.entryentry:MACD & RSI SELL ShortOpen MACD & RSI SELL Sh…strategy.entry

Order rules

OrderFires whenBy defaultLine
Open MACD & RSI BUY Long long((co and crossover(delta, 0)) or (co and crossover(RVOL, 2)) or (crossover(delta, 0) and crossover(RVOL, 2)))On26
Open MACD & RSI SELL Short short((cu and crossunder(delta, 0)) or (cu and crossunder(RVOL, 5)) or (crossunder(delta, 0) and crossunder(RVOL, 5)))On29

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.

Not measuredNo trades to compareThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, but neither the live nor the historical run produced any trades in them, so the replay says nothing either way.
  • 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+32.6%+102.5%1100%—1.5%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h0.0%+5.5%00%—12.1%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+51.3%+9.8%1100%—11.9%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h0.0%+8.4%00%—28.9%8 May 2026 – 21 Oct 2026
SOLUSDT 1D0.0%+16.7%00%—59.4%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+80.5%+21.5%2100%—9.4%8 May 2026 – 21 Oct 2026
BNBUSDT 1D0.0%+148.3%00%—35.3%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h0.0%+17.1%00%—6.7%8 May 2026 – 21 Oct 2026

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

The trades

By market direction

At entry, last 90 barsTradesWonP&L
Rising market1100%$32,594.10
Sideways market0—$0.00
Falling market0—$0.00

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

How bad could the drawdown be?

0.0%

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

0%1%
All 1 trades
SideEntryExitBarsP&L
long7 Nov 2024 75,572.0019 Dec 2024 100,204.0042$32,594.10

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
MACD, RSI, & RVOL Strategy this page—v4 strategy+32.6%11.5%
IFR2 - RSI2 by jocker.soadrsi sma emav4 strategyNo trades on this market
Vin's Playzone Strategy by Vvaz_ema rsi smav5 strategy−908.1%213,570.5%
Momentum Explosion 2CCI RSI by capamema sma rsiv4 strategy+24.1%642.3%
3 x EMA + Stochastic RSI + ATR by tomimarsonema rsi smav4 strategy−42.3%1844.8%
Take Profit On Trend (by BHD_Trade_Bot) by BHD_Trade_Botema rsi smav4 strategy+54.8%913.1%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 12 msYes 1,000 bars in 27 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/// © BobBarker42069//@version=4strategy("MACD, RSI, & RVOL Strategy", overlay=true, max_bars_back=5000,  default_qty_type= strategy.cash, calc_on_order_fills=false, calc_on_every_tick=false,  pyramiding=0, default_qty_value=100000, initial_capital=100000)strategy.risk.allow_entry_in(strategy.direction.long)length = input( 14 )overSold = input( 30 )overBought = input( 70 )price = closevrsi = rsi(price, length)co = crossover(vrsi, overSold)cu = crossunder(vrsi, overBought)fastLength = input(12)slowlength = input(26)MACDLength = input(9)MACD = ema(close, fastLength) - ema(close, slowlength)aMACD = ema(MACD, MACDLength)delta = MACD - aMACDRVOLlen = input(14, minval=1, title="RVOL Length")av = sma(volume, RVOLlen)RVOL = volume / avif (not na(vrsi))     if ((co and crossover(delta, 0)) or (co and crossover(RVOL, 2)) or (crossover(delta, 0) and crossover(RVOL, 2)))        strategy.entry("MACD & RSI BUY Long", strategy.long, comment="BUY LONG")            if ((cu and crossunder(delta, 0)) or (cu and crossunder(RVOL, 5)) or (crossunder(delta, 0) and crossunder(RVOL, 5)))        strategy.entry("MACD & RSI SELL Short", strategy.short, comment="SELL LONG")            //plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)