Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

JS-TechTrading- VWAP Momentum_Pullback Strategy

A Pine Script v5 strategy built on RSI (close, 14), SMA (close, 7) and Crossover (ma, ta.vwap). It has 6 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a stop loss and a profit target. Each trade commits 100% of equity and pays no commission. 17 settings; defaults include Stop-Loss (SL) % 3, Take-Profit (TP) % 7 and Stop-Loss (SL) % 50.

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 JS-TechTrading- VWAP Momentum_Pullback Strategy 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 JS-TechTrading- VWAP Momentum_Pullback Strategy do on BTCUSDT 1D with default settings?
+23.90%
From 26 Jan 2024 to 21 Oct 2026, over 22 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does JS-TechTrading- VWAP Momentum_Pullback Strategy 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: 22 before, 19 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download.
Does JS-TechTrading- VWAP Momentum_Pullback Strategy use a stop loss?
Yes
strategy.exit sets a stop on line 56, 61.
Does JS-TechTrading- VWAP Momentum_Pullback Strategy run in Zeal Terminal?
Yes
It compiles in 27 ms and runs 1,000 bars in 65 ms, in the browser.

BTCUSDT · 1D · default settings

  • Long SL Level
  • Long TP Level
  • 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 (17)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$123,905$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. The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.
Net profit
+23.90%
$23,902.30
Buy and hold
+102.5%
same period
Closed trades
22
9 won · 13 lost
Profitable
40.9%
of closed trades
Profit factor
1.54
gross profit ÷ gross loss
Max drawdown
13.64%
−$17,181.60

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 commission

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

  • Check

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • 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 55, 57, 60, 62. The upgraded version below moves each call inside an if block.

Settings

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

SettingDefaultType and rangeFeeds
SL/TP for Long-Strategy
Activate Long-Strategytrueboolentry Long exit Long SL/TP close Long Long SL Level Long TP Level Short SL Level Short TP Level line 54
Stop-Loss (SL) %3float · min 0long_stoploss_percentage long_stoploss_price
Take-Profit (TP) %7float · min 0long_takeprofit_percentage long_takeprofit_price
SL/TP for Short-Strategy
Activate Short-Strategiefalseboolentry Short exit Short SL/TP close Short Long SL Level Long TP Level Short SL Level Short TP Level line 59
Stop-Loss (SL) %50float · min 0short_stoploss_percentage short_stoploss_price
Take-Profit (TP) %50float · min 0short_takeprofit_percentage short_takeprofit_price
Time-Period for Back-Testing
Start Day1int · min 1 · max 31in_date_range
until Day1int · min 1 · max 31in_date_range
Start Month10int · min 1 · max 12in_date_range
until Month1int · min 1 · max 12in_date_range
Start Year2022int · min 1800 · max 3000in_date_range
until Year2077int · min 1800 · max 3000in_date_range
RSI
Oversold Level40int · min 1was_over_sold
Overbought Level70int · min 1was_over_bought
RSI Length14int · min 1rsi
VWAP
SMA sourceclosesourcema
SMA interval7int · min 0 · max 999 · step 1ma

What it calculates

  • RSIclose, RSI Length (14)rsi · line 40
  • SMASMA source (close), SMA interval (7)ma · line 44
  • Crossoverma, ta.vwapcrossover_bull · line 49
  • Crossunderma, ta.vwapcrossover_bear · line 50

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.

closecloseprice datarsi_lengthRSI Lengthsetting · 14maIntervalSMA intervalsetting · 7long_stoploss_valueStop-Loss (SL) %setting · 3long_takeprofit_valueTake-Profit (TP) %setting · 7short_stoploss_valueStop-Loss (SL) %setting · 50short_takeprofit_valueTake-Profit (TP) %setting · 50timetimeprice datastart_yearStart Yearsetting · 2022start_monthStart Monthsetting · 10start_dateStart Daysetting · 1end_yearuntil Yearsetting · 2077end_monthuntil Monthsetting · 1end_dateuntil Daysetting · 1rsi_over_soldOversold Levelsetting · 40rsi_over_boughtOverbought Levelsetting · 70rsiRSI→ rsimaSMA→ macrossover_bullCrossover→ crossover_bullcrossover_bearCrossunder→ crossover_bearlong_stoploss_percentagelong_stoploss_percentagevaluelong_takeprofit_percentagelong_takeprofit_percent…valueshort_stoploss_percentageshort_stoploss_percenta…valueshort_takeprofit_percentageshort_takeprofit_percen…valuelong_stoploss_pricelong_stoploss_pricevaluelong_takeprofit_pricelong_takeprofit_pricevalueshort_stoploss_priceshort_stoploss_pricevalueshort_takeprofit_priceshort_takeprofit_pricevaluein_date_rangein_date_rangeconditionbuy_signalbuy_signalconditionsell_signalsell_signalconditionwas_over_soldwas_over_soldconditionwas_over_boughtwas_over_boughtconditionentry:LongOpen Longstrategy.entryexit:Long SL/TPexit Long SL/TPstrategy.exitclose:LongClose Longstrategy.closeentry:ShortOpen Shortstrategy.entryexit:Short SL/TPexit Short SL/TPstrategy.exitclose:ShortClose Shortstrategy.closeplot:23Long SL Levelplotplot:24Long TP Levelplotplot:25Short SL Levelplotplot:26Short TP Levelplot

Order rules

OrderFires whenBy defaultLine
Open Long longbuy_signalwas_over_sold and crossover_bullOn55
Exit Long SL/TP stop and limitbuy_signal and in_date_range and enable_long_strategy == trueOn56
Close Longsell_signalwas_over_bought and crossover_bearOn57
Open Short shortsell_signalwas_over_bought and crossover_bearOn60
Exit Short SL/TP stop and limitsell_signal and in_date_range and enable_short_strategy == trueOn61
Close Shortbuy_signalwas_over_sold and crossover_bullOn62

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+23.9%+102.5%2241%1.5413.6%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−6.7%+5.5%1225%0.7413.4%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+41.4%+9.8%3741%1.5217.1%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−14.8%+8.4%1520%0.5520.6%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+3.6%+16.7%3132%1.0532.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−29.5%+21.5%1811%0.2730.6%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+36.4%+148.3%2245%1.9214.7%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+17.8%+17.1%1443%1.6313.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 market367%$11,163.20
Sideways market850%$16,721.20
Falling market1127%−$3,981.99

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

How bad could the drawdown be?

21.1%

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

0%24%
All 22 trades
SideEntryExitBarsP&L
long26 Apr 2024 64,498.3027 Apr 2024 62,563.401−$3,000.02
long9 May 2024 61,193.0015 May 2024 65,476.606$6,790.01
long4 Jul 2024 60,208.604 Jul 2024 58,402.300−$3,113.70
long15 Aug 2024 58,683.4015 Aug 2024 56,922.900−$3,020.30
long17 Sep 2024 58,214.0019 Sep 2024 62,289.002$6,835.92
long5 Mar 2025 87,282.009 Mar 2025 84,677.904−$3,117.52
long19 Mar 2025 82,715.0024 Mar 2025 88,601.305$7,214.07
long7 Apr 2025 78,430.007 Apr 2025 76,077.100−$3,257.65
long2 Jul 2025 105,681.0010 Jul 2025 113,079.008$7,373.16
long23 Oct 2025 107,567.0026 Oct 2025 115,097.003$7,889.29
long30 Oct 2025 110,021.0030 Oct 2025 106,721.000−$3,617.80
long13 Nov 2025 101,654.0013 Nov 2025 98,604.700−$3,509.27
long2 Dec 2025 86,286.003 Dec 2025 92,326.001$7,942.64
long6 Dec 2025 89,330.0015 Dec 2025 86,650.109−$3,642.28
long25 Dec 2025 87,669.405 Jan 2026 93,806.3011$8,243.67
long30 Jan 2026 84,650.2030 Jan 2026 82,110.600−$3,780.31
long18 Feb 2026 67,503.5023 Feb 2026 65,478.405−$3,666.90
long24 Feb 2026 64,656.0024 Feb 2026 62,716.300−$3,556.91
long28 Feb 2026 65,872.1028 Feb 2026 63,895.900−$3,450.19
long8 Mar 2026 67,262.9013 Mar 2026 71,971.305$7,808.92
long19 Jun 2026 62,958.0024 Jun 2026 61,076.005−$3,568.24
long9 Jul 2026 62,290.0021 Jul 2026 66,650.3012$8,105.76

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
JS-TechTrading- VWAP Momentum_Pullback Strategy this page—v5 strategy+23.9%2213.6%
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%

Upgrade and export

Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.

  • 4 strategy calls use the when = argument (line 55, 57, 60, 62). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
  • 1 setting uses the untyped input() (line 42). It still compiles in v6; input.int, input.float or input.source state the type.
  • No v6-only features. v6 is not needed to run this script.

Clean v5

VerifiedDownload the v5 script

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

  • Line 42: input() → input.source()
  • Line 55: when = buy_signal → if block
  • Line 57: when = sell_signal → if block
  • Line 60: when = sell_signal → if block
  • Line 62: when = buy_signal → if block
⋯// VWAP-maSource = input(title='SMA source', defval=close,group = "VWAP")+maSource = input.source(title='SMA source', defval=close,group = "VWAP")maInterval = input.int(title='SMA interval', minval=0, maxval=999, step=1, defval=7,group = "VWAP")⋯if buy_signal and in_date_range and enable_long_strategy == true-    strategy.entry('Long', strategy.long, when=buy_signal, alert_message='Open Long Position')+    if buy_signal+        strategy.entry('Long', strategy.long, alert_message='Open Long Position')    strategy.exit('Long SL/TP', from_entry='Long', loss=long_stoploss_percentage, profit=long_takeprofit_percentage, alert_message='Your SL/TP-Limit for the Long-Strategy has been activated.')-    strategy.close('Long', when=sell_signal, alert_message='Close Long Position')+    if sell_signal+        strategy.close('Long', alert_message='Close Long Position')// Short Strategyif sell_signal and in_date_range and enable_short_strategy == true-    strategy.entry('Short', strategy.short, when=sell_signal, alert_message='Open Short Position')+    if sell_signal+        strategy.entry('Short', strategy.short, alert_message='Open Short Position')    strategy.exit('Short SL/TP', from_entry='Short', loss=short_stoploss_percentage, profit=short_takeprofit_percentage, alert_message='Your SL/TP-Limit for the Short-Strategy has been activated.')-    strategy.close('Short', when=buy_signal, alert_message='Close Short Position')+    if buy_signal+        strategy.close('Short', alert_message='Close Short Position')

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: 22 before, 19 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.

-//@version=5+//@version=6// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 27 msWith a workaround 1,000 bars in 65 msNot measured
PineTSNot testedNot testedNot measured

The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.

“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.

Source

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

//@version=5// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © JS-TechTrading 2023strategy(title='JS-TechTrading: VWAP Momentum_Pullback Strategy', initial_capital=100000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, pyramiding=0, currency='USD', overlay=true)//// Stoploss and Take Profit Parameters// Enable Long Strategyenable_long_strategy = input.bool(true, title='Activate Long-Strategy', group='SL/TP for Long-Strategy', inline='1')long_stoploss_value = input.float(defval=3, title='Stop-Loss (SL) %', minval=0, group='SL/TP for Long-Strategy', inline='2')long_stoploss_percentage = close * (long_stoploss_value / 100) / syminfo.minticklong_takeprofit_value = input.float(defval=7, title='Take-Profit (TP) %', minval=0, group='SL/TP for Long-Strategy', inline='2')long_takeprofit_percentage = close * (long_takeprofit_value / 100) / syminfo.mintick// Enable Short Strategyenable_short_strategy = input.bool(false, title='Activate Short-Strategie', group='SL/TP for Short-Strategy', inline='3')short_stoploss_value = input.float(defval=50, title='Stop-Loss (SL) %', minval=0, group='SL/TP for Short-Strategy', inline='4')short_stoploss_percentage = close * (short_stoploss_value / 100) / syminfo.mintickshort_takeprofit_value = input.float(defval=50, title='Take-Profit (TP) %', minval=0, group='SL/TP for Short-Strategy', inline='4')short_takeprofit_percentage = close * (short_takeprofit_value / 100) / syminfo.mintick// Plot Stoploss & Take Profit Levelslong_stoploss_price = strategy.position_avg_price * (1 - long_stoploss_value / 100)long_takeprofit_price = strategy.position_avg_price * (1 + long_takeprofit_value / 100)short_stoploss_price = strategy.position_avg_price * (1 + short_stoploss_value / 100)short_takeprofit_price = strategy.position_avg_price * (1 - short_takeprofit_value / 100)plot(enable_long_strategy and not enable_short_strategy ? long_stoploss_price : na, color=color.new(#ff0000, 0), style=plot.style_linebr, linewidth=2, title='Long SL Level')plot(enable_long_strategy and not enable_short_strategy ? long_takeprofit_price : na, color=color.new(#008000, 0), style=plot.style_linebr, linewidth=2, title='Long TP Level')plot(enable_short_strategy and not enable_long_strategy ? short_stoploss_price : na, color=color.new(#ff0000, 0), style=plot.style_linebr, linewidth=2, title='Short SL Level')plot(enable_short_strategy and not enable_long_strategy ? short_takeprofit_price : na, color=color.new(#008000, 0), style=plot.style_linebr, linewidth=2, title='Short TP Level')// Date Rangestart_date = input.int(title='Start Day', defval=1, minval=1, maxval=31, group='Time-Period for Back-Testing', inline='1')end_date = input.int(title='until Day', defval=1, minval=1, maxval=31, group='Time-Period for Back-Testing', inline='1')start_month = input.int(title='Start Month', defval=10, minval=1, maxval=12, group='Time-Period for Back-Testing', inline='2')end_month = input.int(title='until Month', defval=1, minval=1, maxval=12, group='Time-Period for Back-Testing', inline='2')start_year = input.int(title='Start Year', defval=2022, minval=1800, maxval=3000, group='Time-Period for Back-Testing', inline='3')end_year = input.int(title='until Year', defval=2077, minval=1800, maxval=3000, group='Time-Period for Back-Testing', inline='3')in_date_range = time >= timestamp(syminfo.timezone, start_year, start_month, start_date, 0, 0) and time < timestamp(syminfo.timezone, end_year, end_month, end_date, 0, 0)//// Indicator Inputs// RSIrsi_over_sold = input.int(defval=40, minval=1, title='Oversold Level', group='RSI')rsi_over_bought = input.int(defval=70, minval=1, title='Overbought Level', group='RSI')rsi_length = input.int(defval=14, minval=1, title='RSI Length', group='RSI')rsi = ta.rsi(close, rsi_length)// VWAPmaSource = input(title='SMA source', defval=close,group = "VWAP")maInterval = input.int(title='SMA interval', minval=0, maxval=999, step=1, defval=7,group = "VWAP")ma = ta.sma(maSource, maInterval)//// Strategy// Creating Long and Short Strategywas_over_sold = ta.barssince(rsi <= rsi_over_sold) <= 10was_over_bought = ta.barssince(rsi >= rsi_over_bought) <= 10crossover_bull = ta.crossover(ma, ta.vwap)crossover_bear = ta.crossunder(ma, ta.vwap)buy_signal = was_over_sold and crossover_bullsell_signal = was_over_bought and crossover_bear// Long Strategyif buy_signal and in_date_range and enable_long_strategy == true    strategy.entry('Long', strategy.long, when=buy_signal, alert_message='Open Long Position')    strategy.exit('Long SL/TP', from_entry='Long', loss=long_stoploss_percentage, profit=long_takeprofit_percentage, alert_message='Your SL/TP-Limit for the Long-Strategy has been activated.')    strategy.close('Long', when=sell_signal, alert_message='Close Long Position')// Short Strategyif sell_signal and in_date_range and enable_short_strategy == true    strategy.entry('Short', strategy.short, when=sell_signal, alert_message='Open Short Position')    strategy.exit('Short SL/TP', from_entry='Short', loss=short_stoploss_percentage, profit=short_takeprofit_percentage, alert_message='Your SL/TP-Limit for the Short-Strategy has been activated.')    strategy.close('Short', when=buy_signal, alert_message='Close Short Position')