Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

RSI of VWAP

A Pine Script v4 strategy built on RSI (vwap, 14) and EMA (close, 200). It has 4 order rules, 1 entry among them, and trades long only with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 20% of equity and pays no commission. 6 settings; defaults include RSI Length 14, RSI Buy Line 70 and RSI Exit Line 90.

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 RSI of VWAP repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did RSI of VWAP do on BTCUSDT 1D with default settings?
Not measured
It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings; it opened a long position that was still open on the last bar, so there is no result to report. On BTCUSDT 4h it did trade; that row of the markets table below has its figures. A backtest, not investment advice.
Can RSI of VWAP 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 RSI of VWAP use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does RSI of VWAP run in Zeal Terminal?
Yes
It compiles in 18 ms and runs 1,000 bars in 45 ms, in the browser.

BTCUSDT · 1D · default settings

  • EMA 200
  • VWAP
  • 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 (6)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$12,879$20,253Equity from $10,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. Zeal Terminal's engine currently reads an order side written as long = true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 23) so the engine trades the way the script says.
Net profit
0.00%
$0.00
Buy and hold
+102.5%
same period
Closed trades
0
0 won · 0 lost
Profitable
0.0%
of closed trades
Profit factor
—
gross profit ÷ gross loss
Max drawdown
12.12%
−$1,211.76

One run with the author's default settings, $10,000 starting capital, commission as the script sets it. A long position was still open at the last bar. 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(vwapRsi, 99) ignores the settings line 30

    Line 30 hard-codes 99 where line 23 uses “RSI Buy Line”. Changing those settings moves one band but not this one.

    crossover(vwapRsi,99)crossover(vwapRsi, buyLine)
  • 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 23, 30, 32, 34. The upgraded version below moves each call inside an if block.

  • Note

    Uses transp =, which v5 removed line 14

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

  • Note

    Uses long =, which v5 renamed line 23

    long = on line 23. v5 writes it as direction = strategy.long or strategy.short.

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, ema → ta.ema, crossover → ta.crossover, tostring → str.tostring, crossunder → ta.crossunder.
  • 4 strategy calls use the when = argument (line 23, 30, 32, 34). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

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

  • Line 3: //@version=4 → //@version=5
  • Line 11: vwap → ta.vwap
  • Line 12: rsi → ta.rsi
  • Line 12: vwap → ta.vwap
  • Line 13: ema → ta.ema
  • Line 14: transp = 25 → color.new(color.orange, 25)
9 more edits
  • Line 15: transp = 25 → color.new(color.purple, 25)
  • Line 23: long = true → direction = strategy.long
  • Line 23: crossover → ta.crossover
  • Line 28: transp = 80 → color.new(strategy.position_size>=1?color.blue:na, 80)
  • Line 30: tostring → str.tostring
  • Line 30: crossover → ta.crossover
  • Line 32: tostring → str.tostring
  • Line 32: crossunder → ta.crossunder
  • Line 34: tostring → str.tostring
⋯// © mohanee-//@version=4+//@version=5strategy(title="RSI of VWAP", overlay=true, pyramiding=1,     default_qty_type=strategy.percent_of_equity,  default_qty_value=20, initial_capital=10000, currency=currency.USD)  //default_qty_value=10, default_qty_type=strategy.fixed,⋯partialExit=input(true,title="Allow Partial exit / take profits")-myVwap=vwap+myVwap=ta.vwap-vwapRsi=rsi(vwap,rsiLength)+vwapRsi=ta.rsi(ta.vwap,rsiLength)-ema200=ema(close,200)+ema200=ta.ema(close,200)-plot(ema200, title="EMA 200", color=color.orange,  transp=25)+plot(ema200, title="EMA 200", color=color.new(color.orange, 25))-plot(myVwap, title="VWAP", color=color.purple,  transp=25)+plot(myVwap, title="VWAP", color=color.new(color.purple, 25))//plot(close)⋯//more than 80%-strategy.entry(id="LE", comment="Entry", long=true, qty=qty1, when=crossover(vwapRsi,buyLine) and close>ema200 )+strategy.entry(id="LE", comment="Entry", direction = strategy.long, qty=qty1, when=ta.crossover(vwapRsi,buyLine) and close>ema200 )//stoploss⋯plot(strategy.position_size>=1 ? stopLossVal : na, color = color.purple , style=plot.style_linebr,  linewidth = 2, title = "stop loss")-bgcolor(strategy.position_size>=1?color.blue:na, transp=80)+bgcolor(color.new(strategy.position_size>=1?color.blue:na, 80))if(partialExit==true)-    strategy.close(id="LE",comment="TP points="+tostring(close - strategy.position_avg_price, "####.##"),qty=strategy.position_size/3, when=crossover(vwapRsi,99) )  //and close>ema200+    strategy.close(id="LE",comment="TP points="+str.tostring(close - strategy.position_avg_price, "####.##"),qty=strategy.position_size/3, when=ta.crossover(vwapRsi,99) )  //and close>ema200    -strategy.close_all(comment="Exit All points="+tostring(close - strategy.position_avg_price, "####.##"), when=crossunder(vwapRsi,exitLine) )  //and close>ema200+strategy.close_all(comment="Exit All points="+str.tostring(close - strategy.position_avg_price, "####.##"), when=ta.crossunder(vwapRsi,exitLine) )  //and close>ema200//close all on stop loss-strategy.close_all(comment="Exit points="+tostring(close - strategy.position_avg_price, "####.##"), when=close<stopLossVal )  //and close>ema200+strategy.close_all(comment="Exit points="+str.tostring(close - strategy.position_avg_price, "####.##"), when=close<stopLossVal )  //and close>ema200

Clean v5

VerifiedDownload the v5 script

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

  • Line 5: input() → input.int()
  • Line 6: input() → input.int()
  • Line 7: input() → input.int()
  • Line 8: input() → input.int()
  • Line 9: input() → input.int()
  • Line 10: input() → input.bool()
4 more edits
  • Line 23: when = ta.crossover(vwapRsi,buyLine) and close>ema200 → if block
  • Line 30: when = ta.crossover(vwapRsi,99) → if block
  • Line 32: when = ta.crossunder(vwapRsi,exitLine) → if block
  • Line 34: when = close<stopLossVal → if block
⋯strategy(title="RSI of VWAP", overlay=true, pyramiding=1,     default_qty_type=strategy.percent_of_equity,  default_qty_value=20, initial_capital=10000, currency=currency.USD)  //default_qty_value=10, default_qty_type=strategy.fixed,-rsiLength=input(14,title="RSI Length", minval=1, maxval=50)+rsiLength=input.int(14,title="RSI Length", minval=1, maxval=50)-buyLine=input(70,title="RSI Buy Line", minval=30, maxval=100)+buyLine=input.int(70,title="RSI Buy Line", minval=30, maxval=100)-exitLine=input(90,title="RSI Exit Line", minval=0, maxval=100)+exitLine=input.int(90,title="RSI Exit Line", minval=0, maxval=100)-riskCapital = input(title="Risk % of capital", defval=10, minval=1)+riskCapital = input.int(title="Risk % of capital", defval=10, minval=1)-stopLoss=input(5,title="Stop Loss",minval=1)+stopLoss=input.int(5,title="Stop Loss",minval=1)-partialExit=input(true,title="Allow Partial exit / take profits")+partialExit=input.bool(true,title="Allow Partial exit / take profits")myVwap=ta.vwap⋯//more than 80%-strategy.entry(id="LE", comment="Entry", direction = strategy.long, qty=qty1, when=ta.crossover(vwapRsi,buyLine) and close>ema200 )+if ta.crossover(vwapRsi,buyLine) and close>ema200+    strategy.entry(id="LE", comment="Entry", direction = strategy.long, qty=qty1 )//stoploss⋯if(partialExit==true)-    strategy.close(id="LE",comment="TP points="+str.tostring(close - strategy.position_avg_price, "####.##"),qty=strategy.position_size/3, when=ta.crossover(vwapRsi,99) )  //and close>ema200+    if ta.crossover(vwapRsi,99)+        strategy.close(id="LE",comment="TP points="+str.tostring(close - strategy.position_avg_price, "####.##"),qty=strategy.position_size/3 )  //and close>ema200    -strategy.close_all(comment="Exit All points="+str.tostring(close - strategy.position_avg_price, "####.##"), when=ta.crossunder(vwapRsi,exitLine) )  //and close>ema200+if ta.crossunder(vwapRsi,exitLine)+    strategy.close_all(comment="Exit All points="+str.tostring(close - strategy.position_avg_price, "####.##") )  //and close>ema200//close all on stop loss-strategy.close_all(comment="Exit points="+str.tostring(close - strategy.position_avg_price, "####.##"), when=close<stopLossVal )  //and close>ema200+if close<stopLossVal+    strategy.close_all(comment="Exit points="+str.tostring(close - strategy.position_avg_price, "####.##") )  //and close>ema200

Does it run in Pine Script v6?

Yes

Same 3 trades and the same P&L on BTCUSDT 4h, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. It differs from the v5 version by 1 edit.

Download the v6 script

⋯// © mohanee-//@version=5+//@version=6strategy(title="RSI of VWAP", overlay=true, pyramiding=1,     default_qty_type=strategy.percent_of_equity,  default_qty_value=20, initial_capital=10000, currency=currency.USD)  //default_qty_value=10, default_qty_type=strategy.fixed,⋯

Settings

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

SettingDefaultType and rangeFeeds
RSI Length14int · min 1 · max 50vwapRsi
RSI Buy Line70int · min 30 · max 100entry LE
RSI Exit Line90int · min 0 · max 100close_all
Risk % of capital10int · min 1qty1
Stop Loss5int · min 1qty1 stopLossVal
Allow Partial exit / take profitstrueboolclose LE line 29

What it calculates

  • RSI (rsi, ta.rsi in v5)vwap, RSI Length (14)vwapRsi · line 12
  • EMA (ema, ta.ema in v5)close, 200ema200 · line 13

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 Lengthsetting · 14closecloseprice datariskCapitalRisk % of capitalsetting · 10stopLossStop Losssetting · 5buyLineRSI Buy Linesetting · 70exitLineRSI Exit Linesetting · 90vwapRsiRSI→ vwapRsiema200EMA→ ema200myVwapmyVwapvalueqty1qty1valuestopLossValstopLossValvalueentry:LEOpen LEstrategy.entryclose:LEClose LEstrategy.closeclose_all:close_all strategy.close_allplot:14EMA 200plotplot:15VWAPplotplot:27stop lossplotbgcolor:28bgcolorbgcolor

Order rules

OrderFires whenBy defaultLine
Open LE longcrossover(vwapRsi,buyLine) and close>ema200On23
Close LEcrossover(vwapRsi,99)On30
Close crossunder(vwapRsi,exitLine)On32
Close close<stopLossValOn34

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 1D0.0%+102.5%00%—12.1%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+27.8%+5.5%3100%—6.7%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−21.6%+9.8%30%0.0028.3%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+37.0%+8.4%2100%—4.9%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−45.8%+16.7%80%0.0047.2%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+28.5%+21.5%475%5.977.2%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−31.0%+148.3%50%0.0031.7%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+18.5%+17.1%367%3.905.7%8 May 2026 – 21 Oct 2026

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

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
RSI of VWAP this page—v4 strategy0.0%012.1%
RSI Cross [xaurr] by livetrendrsi emav4 strategy+24.4%5335.3%
Bitpanda Coinrule Template by joshuajcoop01rsi emav5 strategy−2.8%44.6%
RSI with Slow and Fast MA Crossing Strategy (by Coinrule) by Coinrulersi emav5 strategy−2.8%44.6%
EMA SCALPEUR + RSi - SHORT by YukalMoonrsi emav5 strategyNo trades on this market
BTC Sentiment analysis RSI 2xEMA by exlux99rsi emav4 strategyNo trades on this market

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 18 msWith a workaround 1,000 bars in 45 msNot measured
PineTSNo v5 and v6 only—Not measured

Zeal Terminal's engine currently reads an order side written as long = true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 23) so the engine trades the way the script says.

“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/// © mohanee//@version=4strategy(title="RSI of VWAP", overlay=true, pyramiding=1,     default_qty_type=strategy.percent_of_equity,  default_qty_value=20, initial_capital=10000, currency=currency.USD)  //default_qty_value=10, default_qty_type=strategy.fixed,rsiLength=input(14,title="RSI Length", minval=1, maxval=50)buyLine=input(70,title="RSI Buy Line", minval=30, maxval=100)exitLine=input(90,title="RSI Exit Line", minval=0, maxval=100)riskCapital = input(title="Risk % of capital", defval=10, minval=1)stopLoss=input(5,title="Stop Loss",minval=1)partialExit=input(true,title="Allow Partial exit / take profits")myVwap=vwapvwapRsi=rsi(vwap,rsiLength)ema200=ema(close,200)plot(ema200, title="EMA 200", color=color.orange,  transp=25)plot(myVwap, title="VWAP", color=color.purple,  transp=25)//plot(close)//Entry--//Echeck how many units can be purchased based on risk manage ment and stop lossqty1 = (strategy.equity  * riskCapital / 100 ) /  (close*stopLoss/100)  //check if cash is sufficient  to buy qty1  , if capital not available use the available capital onlyqty1:= (qty1 * close >= strategy.equity ) ? (strategy.equity / close) : qty1//more than 80%strategy.entry(id="LE", comment="Entry", long=true, qty=qty1, when=crossover(vwapRsi,buyLine) and close>ema200 )//stoplossstopLossVal=  strategy.position_size>=1 ?  (strategy.position_avg_price * (1-(stopLoss*0.01) )) : 0.00//draw initil stop lossplot(strategy.position_size>=1 ? stopLossVal : na, color = color.purple , style=plot.style_linebr,  linewidth = 2, title = "stop loss")bgcolor(strategy.position_size>=1?color.blue:na, transp=80)if(partialExit==true)    strategy.close(id="LE",comment="TP points="+tostring(close - strategy.position_avg_price, "####.##"),qty=strategy.position_size/3, when=crossover(vwapRsi,99) )  //and close>ema200    strategy.close_all(comment="Exit All points="+tostring(close - strategy.position_avg_price, "####.##"), when=crossunder(vwapRsi,exitLine) )  //and close>ema200//close all on stop lossstrategy.close_all(comment="Exit points="+tostring(close - strategy.position_avg_price, "####.##"), when=close<stopLossVal )  //and close>ema200