Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

JBravo Swing with GoGo Juice

A Pine Script v4 strategy built on SMA (close, 9), EMA (close, 20) and VWAP (hlc3). 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.

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 JBravo Swing with GoGo Juice repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 29 of 29 trades.
How did JBravo Swing with GoGo Juice do on BTCUSDT 1D with default settings?
+68.74%
From 26 Jan 2024 to 21 Oct 2026, over 93 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can JBravo Swing with GoGo Juice 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.
What alerts does JBravo Swing with GoGo Juice have?
2
Buy Signal; Sell Signal.
Does JBravo Swing with GoGo Juice use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.

BTCUSDT · 1D · default settings

  • SMA 9
  • EMA 20
  • VWAP
  • SMA 180
  • 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,000AprJulOct2025AprJulOct2026AprJulOctSMA 9$165,897$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
+68.74%
$68,743.50
Buy and hold
+102.5%
same period
Closed trades
93
28 won · 65 lost
Profitable
30.1%
of closed trades
Profit factor
1.58
gross profit ÷ gross loss
Max drawdown
22.29%
−$24,552.50

One run with the author's default settings, $100,000 starting capital, commission as the script sets it. A short 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.

  • 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 64, 65, 66, 67. The upgraded version below moves each call inside an if block.

  • Note

    Uses iff(), which v5 removed line 28

    iff() on line 28, 31, 39, 40, 44, 45. v5 writes it as the ternary c ? a : b.

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 sma → ta.sma, ema → ta.ema, vwap → ta.vwap, lowest → ta.lowest.
  • 4 strategy calls use the when = argument (line 64, 65, 66, 67). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

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

  • Line 3: //@version=4 → //@version=5
  • Line 7: input(type = input.bool) → input.bool()
  • Line 8: input(type = input.bool) → input.bool()
  • Line 9: input(type = input.bool) → input.bool()
  • Line 11: input(type = input.bool) → input.bool()
  • Line 12: sma → ta.sma
20 more edits
  • Line 13: ema → ta.ema
  • Line 14: sma → ta.sma
  • Line 19: vwap → ta.vwap
  • Line 24: sma → ta.sma
  • Line 24: sma → ta.sma
  • Line 28: iff(c, a, b) → (c ? a : b)
  • Line 28: lowest → ta.lowest
  • Line 28: lowest → ta.lowest
  • Line 28: lowest → ta.lowest
  • Line 28: lowest → ta.lowest
  • Line 29: lowest → ta.lowest
  • Line 31: iff(c, a, b) → (c ? a : b)
  • Line 33: sma → ta.sma
  • Line 33: sma → ta.sma
  • Line 35: ema → ta.ema
  • Line 35: sma → ta.sma
  • Line 39: iff(c, a, b) → (c ? a : b)
  • Line 40: iff(c, a, b) → (c ? a : b)
  • Line 44: iff(c, a, b) → (c ? a : b)
  • Line 45: iff(c, a, b) → (c ? a : b)
⋯// © bradvaughn-//@version=4+//@version=5strategy("JBravo Swing", overlay = false)⋯//Moving Averages-smaInput1 = input(title="Display SMA 9", type=input.bool, defval=true)+smaInput1 = input.bool(title="Display SMA 9", defval=true)-smaInput2 = input(title="Display EMA 20", type=input.bool, defval=true)+smaInput2 = input.bool(title="Display EMA 20", defval=true)-smaInput4 = input(title="Display SMA 180", type=input.bool, defval=true)+smaInput4 = input.bool(title="Display SMA 180", defval=true)colored_180 = input(false, title="Color-code 180 trend direction")-vwapInput = input(title="Display VWAP", type=input.bool, defval=true)+vwapInput = input.bool(title="Display VWAP", defval=true)-sma9 = sma(close, 9)+sma9 = ta.sma(close, 9)-ema20 = ema(close, 20)+ema20 = ta.ema(close, 20)-sma180 = sma(close, 180)+sma180 = ta.sma(close, 180)//Plot Moving Averages⋯// Plot VWAP-vwap1 = vwap(hlc3)+vwap1 = ta.vwap(hlc3)plot(vwapInput ? vwap1 : na, color = color.blue, title="VWAP")⋯//Color SMA 180 trend direction if selected-sma180_uptrend = sma(close, 180) > sma(close[2], 180)+sma180_uptrend = ta.sma(close, 180) > ta.sma(close[2], 180)colr = sma180_uptrend == true or colored_180 == false ? color.white : colored_180 == true ? color.gray : na⋯//Get value of lower end of candle-buyLow = iff(lowest(open, 1) < lowest(close, 1), lowest(open, 1), lowest(close, 1))+buyLow = (ta.lowest(open, 1) < ta.lowest(close, 1) ? ta.lowest(open, 1) : ta.lowest(close, 1))-sellLow = lowest(close, 1)+sellLow = ta.lowest(close, 1)// Find the lower MA for crossover sell condition-sellma = iff((sma9<ema20), sma9, ema20)+sellma = ((sma9<ema20) ? sma9 : ema20)//SMA 9 trend direction-sma9_uptrend = sma(close, 9) > sma(close[2], 9)+sma9_uptrend = ta.sma(close, 9) > ta.sma(close[2], 9)//EMA 20 trend direction-ema20_uptrend = ema(close, 20) > sma(close[2], 20)+ema20_uptrend = ta.ema(close, 20) > ta.sma(close[2], 20)//Buy or sell if conditions are met⋯// Sell when the candle low is below the lower of SMA9 and EMA20-Buy = iff(buy_in_progress == false and buyLow > sma9 == true, true, false)+Buy = (buy_in_progress == false and buyLow > sma9 == true ? true : false)-Sell = iff(buy_in_progress == true and sellLow < sellma == true, true, false)+Sell = (buy_in_progress == true and sellLow < sellma == true ? true : false)// Determine stong buy and strong sell conditions.⋯// If the moving averages are not up (ie. down) then this will qualify a sell as a strong sell-StrongBuy = iff (Buy and sma9_uptrend and sma180_uptrend and ema20_uptrend and (sma9 > ema20) and (ema20 > sma180), true, false)+StrongBuy = (Buy and sma9_uptrend and sma180_uptrend and ema20_uptrend and (sma9 > ema20) and (ema20 > sma180) ? true : false)-StrongSell = iff (Sell and not sma9_uptrend and not sma180_uptrend and not ema20_uptrend and (sma9 < ema20) and (ema20 < sma180), true, false)+StrongSell = (Sell and not sma9_uptrend and not sma180_uptrend and not ema20_uptrend and (sma9 < ema20) and (ema20 < sma180) ? true : false)//Update Trading status if bought or sold⋯

Clean v5

VerifiedDownload the v5 script

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

  • Line 10: input() → input.bool()
  • Line 64: when = vwaplong and vwapInput → if block
  • Line 65: when = vwapshort and vwapInput → if block
  • Line 66: when = vwapshort and vwapInput → if block
  • Line 67: when = vwaplong and vwapInput → if block
⋯smaInput4 = input.bool(title="Display SMA 180", defval=true)-colored_180 = input(false, title="Color-code 180 trend direction")+colored_180 = input.bool(false, title="Color-code 180 trend direction")vwapInput = input.bool(title="Display VWAP", defval=true)⋯plotshape(StrongSell,title="Strong Sell", color=color.red, style=shape.arrowdown,text="Strong Sell")-strategy.entry("GoGo Long", strategy.long, 1, when=vwaplong and vwapInput)+if vwaplong and vwapInput+    strategy.entry("GoGo Long", strategy.long, 1)-strategy.entry("GoGo Short", strategy.short, 1, when=vwapshort and vwapInput)+if vwapshort and vwapInput+    strategy.entry("GoGo Short", strategy.short, 1)-strategy.close("GoGo Long", when = vwapshort and vwapInput)+if vwapshort and vwapInput+    strategy.close("GoGo Long")-strategy.close("GoGo Short", when = vwaplong and vwapInput)+if vwaplong and vwapInput+    strategy.close("GoGo Short")alertcondition(Buy, title="Buy Signal", message="Buy")⋯

Does it run in Pine Script v6?

Yes

Same 93 trades and the same P&L on BTCUSDT 1D, 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

⋯// © bradvaughn-//@version=5+//@version=6strategy("JBravo Swing", overlay = false)⋯

Settings

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

SettingDefaultType and rangeFeeds
Display SMA 9trueboolSMA 9
Display EMA 20trueboolEMA 20
Display SMA 180trueboolSMA 180
Color-code 180 trend directionfalseboolcolr
Display VWAPtrueboolVWAP entry GoGo Long entry GoGo Short close GoGo Long close GoGo Short

What it calculates

  • SMA (sma, ta.sma in v5)close, 9sma9 · line 12
  • EMA (ema, ta.ema in v5)close, 20ema20 · line 13
  • SMA (sma, ta.sma in v5)close, 180sma180 · line 14
  • VWAP (vwap, ta.vwap in v5)hlc3vwap1 · line 19
  • Lowest (lowest, ta.lowest in v5)close, 1sellLow · line 29

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 datahlc3hlc3price datahlc3 · volumehlc3 · volumeprice dataopenopenprice datasma9SMA→ sma9ema20EMA→ ema20sma180SMA→ sma180vwap1VWAP→ vwap1sellLowLowest→ sellLowvwaplong, vwapshortvwaplong · vwapshort2 conditionssma180_uptrend, sma9_uptrend, ema20_uptrendsma180_uptrend · sma9_u…3 conditionsbuyLowbuyLowconditionsellmasellmaconditionBuyBuyconditionSellSellconditionStrongBuyStrongBuyconditionStrongSellStrongSellconditioncolrColourcolrentry:GoGo LongOpen GoGo Longstrategy.entryentry:GoGo ShortOpen GoGo Shortstrategy.entryclose:GoGo LongClose GoGo Longstrategy.closeclose:GoGo ShortClose GoGo Shortstrategy.closeplot:16SMA 9plotplot:17EMA 20plotplot:20VWAPplotplot:26SMA 180plotplotshape:60Buyplotshapeplotshape:61Strong Buyplotshapeplotshape:62Sellplotshapeplotshape:63Strong Sellplotshapealertcondition:68Buy Signalalertconditionalertcondition:69Sell Signalalertcondition

Order rules

OrderFires whenBy defaultLine
Open GoGo Long longvwaplong and vwapInputOn64
Open GoGo Short shortvwapshort and vwapInputOn65
Close GoGo Longvwapshort and vwapInputOn66
Close GoGo Shortvwaplong and vwapInputOn67

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

Alerts

AlertCallMessageLine
Buy SignalalertconditionBuy68
Sell SignalalertconditionSell69

Does it repaint?

No

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

29/29trades 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+68.7%+102.5%9330%1.5822.3%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−0.3%+5.5%6427%0.9911.4%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+5.0%+9.8%8940%1.941.2%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.5%+8.4%7229%1.330.7%8 May 2026 – 21 Oct 2026
SOLUSDT 1D+0.2%+16.7%9734%1.500.1%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.0%+21.5%7231%1.500.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.1%+148.3%10928%1.100.4%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.2%+17.1%6232%1.620.1%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 market3829%$2,792.40
Sideways market3438%$55,856.20
Falling market2119%$10,094.90

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

How bad could the drawdown be?

29.3%

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

0%34%
All 93 trades
SideEntryExitBarsP&L
long15 Feb 2024 51,795.2020 Mar 2024 61,937.4034$10,142.20
short20 Mar 2024 61,937.4022 Mar 2024 65,501.302−$3,563.87
long22 Mar 2024 65,501.3023 Mar 2024 63,796.601−$1,704.64
short23 Mar 2024 63,796.6025 Mar 2024 67,210.002−$3,413.36
long25 Mar 2024 67,210.003 Apr 2024 65,464.009−$1,746.01
short3 Apr 2024 65,464.007 Apr 2024 68,896.004−$3,432.01
long7 Apr 2024 68,896.0013 Apr 2024 67,116.506−$1,779.48
short13 Apr 2024 67,116.5023 Apr 2024 66,819.3010$297.20
long23 Apr 2024 66,819.3025 Apr 2024 64,289.602−$2,529.74
short25 Apr 2024 64,289.605 May 2024 63,892.0010$397.55
long5 May 2024 63,892.008 May 2024 62,312.103−$1,579.96
short8 May 2024 62,312.1016 May 2024 66,206.508−$3,894.44
long16 May 2024 66,206.5012 Jun 2024 67,314.2027$1,107.72
short12 Jun 2024 67,314.2015 Jul 2024 60,797.9033$6,516.32
long15 Jul 2024 60,797.902 Aug 2024 65,354.0018$4,556.11
short2 Aug 2024 65,354.0022 Aug 2024 61,156.0020$4,197.99
long22 Aug 2024 61,156.0028 Aug 2024 59,415.006−$1,741.03
short28 Aug 2024 59,415.0013 Sep 2024 58,132.3016$1,282.69
long13 Sep 2024 58,132.3017 Sep 2024 58,214.004$81.68
short17 Sep 2024 58,214.0018 Sep 2024 60,314.001−$2,100.00
long18 Sep 2024 60,314.002 Oct 2024 60,804.9014$490.93
short2 Oct 2024 60,804.907 Oct 2024 62,819.905−$2,014.99
long7 Oct 2024 62,819.9010 Oct 2024 60,636.003−$2,183.90
short10 Oct 2024 60,636.0012 Oct 2024 62,540.002−$1,903.98
long12 Oct 2024 62,540.005 Nov 2024 67,850.0024$5,310.02
short5 Nov 2024 67,850.006 Nov 2024 69,372.001−$1,522.00
long6 Nov 2024 69,372.0020 Dec 2024 97,461.9044$28,089.90
short20 Dec 2024 97,461.9026 Dec 2024 99,429.606−$1,967.75
long26 Dec 2024 99,429.6027 Dec 2024 95,791.601−$3,638.01
short27 Dec 2024 95,791.603 Jan 2025 96,984.807−$1,193.19
long3 Jan 2025 96,984.809 Jan 2025 95,060.606−$1,924.18
short9 Jan 2025 95,060.6015 Jan 2025 96,560.906−$1,500.24
long15 Jan 2025 96,560.9028 Jan 2025 102,083.0013$5,521.98
short28 Jan 2025 102,083.0029 Jan 2025 101,336.001$747.31
long29 Jan 2025 101,336.002 Feb 2025 100,636.004−$699.86
short2 Feb 2025 100,636.0021 Feb 2025 98,305.0019$2,330.65
long21 Feb 2025 98,305.0022 Feb 2025 96,182.001−$2,123.02
short22 Feb 2025 96,182.0024 Mar 2025 86,082.5030$10,099.50
long24 Mar 2025 86,082.5029 Mar 2025 84,424.405−$1,658.12
short29 Mar 2025 84,424.4013 Apr 2025 85,276.9015−$852.53
long13 Apr 2025 85,276.9031 May 2025 103,985.0048$18,708.60
short31 May 2025 103,985.004 Jun 2025 105,377.004−$1,391.43
long4 Jun 2025 105,377.005 Jun 2025 104,697.001−$680.04
short5 Jun 2025 104,697.008 Jun 2025 105,552.003−$855.29
long8 Jun 2025 105,552.0014 Jun 2025 106,067.006$514.44
short14 Jun 2025 106,067.0017 Jun 2025 106,795.003−$727.94
long17 Jun 2025 106,795.0018 Jun 2025 104,551.001−$2,243.36
short18 Jun 2025 104,551.0025 Jun 2025 106,083.007−$1,531.83
long25 Jun 2025 106,083.001 Aug 2025 115,764.0037$9,681.07
short1 Aug 2025 115,764.008 Aug 2025 117,472.007−$1,707.95
long8 Aug 2025 117,472.0017 Aug 2025 117,381.009−$91.36
short17 Aug 2025 117,381.0018 Aug 2025 117,405.001−$24.35
long18 Aug 2025 117,405.0019 Aug 2025 116,227.001−$1,177.96
short19 Aug 2025 116,227.009 Sep 2025 112,065.0021$4,161.82
long9 Sep 2025 112,065.0023 Sep 2025 112,651.0014$585.76
short23 Sep 2025 112,651.0030 Sep 2025 114,312.007−$1,660.98
long30 Sep 2025 114,312.0011 Oct 2025 112,774.0011−$1,537.48
short11 Oct 2025 112,774.0027 Oct 2025 114,559.0016−$1,784.92
long27 Oct 2025 114,559.0030 Oct 2025 110,021.003−$4,538.11
short30 Oct 2025 110,021.004 Dec 2025 93,429.9035$16,591.40
long4 Dec 2025 93,429.906 Dec 2025 89,330.002−$4,099.91
short6 Dec 2025 89,330.0010 Dec 2025 92,678.804−$3,348.77
long10 Dec 2025 92,678.8013 Dec 2025 90,268.403−$2,410.38
short13 Dec 2025 90,268.402 Jan 2026 88,839.1020$1,429.38
long2 Jan 2026 88,839.1021 Jan 2026 88,427.7019−$411.39
short21 Jan 2026 88,427.705 Mar 2026 72,666.8043$15,760.90
long5 Mar 2026 72,666.808 Mar 2026 67,262.903−$5,403.86
short8 Mar 2026 67,262.9011 Mar 2026 69,948.603−$2,685.73
long11 Mar 2026 69,948.6020 Mar 2026 69,930.009−$18.63
short20 Mar 2026 69,930.0025 Mar 2026 70,556.705−$626.73
long25 Mar 2026 70,556.7027 Mar 2026 68,820.302−$1,736.43
short27 Mar 2026 68,820.307 Apr 2026 68,853.7011−$33.35
long7 Apr 2026 68,853.7017 May 2026 78,148.1040$9,294.39
short17 May 2026 78,148.104 Jul 2026 62,583.3048$15,564.80
long4 Jul 2026 62,583.309 Jul 2026 62,290.005−$293.25
short9 Jul 2026 62,290.0010 Jul 2026 63,230.001−$940.00
long10 Jul 2026 63,230.0014 Jul 2026 62,334.504−$895.49
short14 Jul 2026 62,334.5015 Jul 2026 65,044.001−$2,709.47
long15 Jul 2026 65,044.0026 Jul 2026 64,375.0011−$668.98
short26 Jul 2026 64,375.0027 Jul 2026 65,400.001−$1,024.99
long27 Jul 2026 65,400.0029 Jul 2026 63,915.002−$1,485.00
short29 Jul 2026 63,915.0031 Jul 2026 64,780.002−$865.03
long31 Jul 2026 64,780.001 Aug 2026 62,887.901−$1,892.15
short1 Aug 2026 62,887.905 Aug 2026 64,106.604−$1,218.67
long5 Aug 2026 64,106.6012 Aug 2026 63,600.007−$506.54
short12 Aug 2026 63,600.0018 Aug 2026 64,532.106−$932.10
long18 Aug 2026 64,532.1014 Sep 2026 76,842.0027$12,309.90
short14 Sep 2026 76,842.0015 Sep 2026 78,189.201−$1,347.19
long15 Sep 2026 78,189.2016 Sep 2026 75,644.501−$2,544.72
short16 Sep 2026 75,644.5019 Sep 2026 80,883.903−$5,239.38
long19 Sep 2026 80,883.909 Oct 2026 81,754.5020$870.60
short9 Oct 2026 81,754.5012 Oct 2026 83,773.103−$2,018.66
long12 Oct 2026 83,773.1013 Oct 2026 81,850.001−$1,923.11

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
JBravo Swing with GoGo Juice this page—v4 strategy+68.7%9322.3%
ZVWAP strategy by mohaneesma ema vwapv4 strategy+614.4%13748.5%
Ultimate Oscillator [Long] Strategy by mohaneesma vwap emav4 strategyNo trades on this market
Morning Scalp Strategy by Trading_Biteslowest ema vwapv5 strategyNo trades on this market
VWAP and BB strategy [EEMANI] by mohaneeema vwap smav4 strategyNo trades on this market
Buying Selling Volume Strategy by exlux99vwap ema smav5 strategyNo trades on this market

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 17 msYes 1,000 bars in 57 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/// © bradvaughn//@version=4strategy("JBravo Swing", overlay = false)var buy_in_progress = false//Moving AveragessmaInput1 = input(title="Display SMA 9", type=input.bool, defval=true)smaInput2 = input(title="Display EMA 20", type=input.bool, defval=true)smaInput4 = input(title="Display SMA 180", type=input.bool, defval=true)colored_180 = input(false, title="Color-code 180 trend direction")vwapInput = input(title="Display VWAP", type=input.bool, defval=true)sma9 = sma(close, 9)ema20 = ema(close, 20)sma180 = sma(close, 180)//Plot Moving Averagesplot(smaInput1 ? sma9 : na, color= color.red, title="SMA 9")plot(smaInput2 ? ema20 : na, color = color.yellow, title="EMA 20")// Plot VWAPvwap1 = vwap(hlc3)plot(vwapInput ? vwap1 : na, color = color.blue, title="VWAP")vwaplong = vwap1 > ema20vwapshort = vwap1 < ema20//Color SMA 180 trend direction if selectedsma180_uptrend = sma(close, 180) > sma(close[2], 180)colr = sma180_uptrend == true or colored_180 == false ? color.white : colored_180 == true ? color.gray : naplot(smaInput4 ? sma180 : na, color = colr, title="SMA 180")//Get value of lower end of candlebuyLow = iff(lowest(open, 1) < lowest(close, 1), lowest(open, 1), lowest(close, 1))sellLow = lowest(close, 1)// Find the lower MA for crossover sell conditionsellma = iff((sma9<ema20), sma9, ema20)//SMA 9 trend directionsma9_uptrend = sma(close, 9) > sma(close[2], 9)//EMA 20 trend directionema20_uptrend = ema(close, 20) > sma(close[2], 20)//Buy or sell if conditions are met// Buy when the candle low is above the SMA9// Sell when the candle low is below the lower of SMA9 and EMA20Buy = iff(buy_in_progress == false and buyLow > sma9 == true, true, false)Sell = iff(buy_in_progress == true and sellLow < sellma == true, true, false)// Determine stong buy and strong sell conditions.// If moving averages are all up, then this will qualify a buy as a strong buy.// If the moving averages are not up (ie. down) then this will qualify a sell as a strong sellStrongBuy = iff (Buy and sma9_uptrend and sma180_uptrend and ema20_uptrend and (sma9 > ema20) and (ema20 > sma180), true, false)StrongSell = iff (Sell and not sma9_uptrend and not sma180_uptrend and not ema20_uptrend and (sma9 < ema20) and (ema20 < sma180), true, false)//Update Trading status if bought or soldif Buy    buy_in_progress := trueif Sell    buy_in_progress := false    // Clear Buy and Sell conditions if StrongBuy or StrongSell conditions exist.  // This disables plotting Buy and Sell conditionsif StrongBuy    Buy := falseif StrongSell    Sell := false    //Display BUY/SELL indicatorsplotshape(Buy,title="Buy", color=color.green, style=shape.arrowup,location=location.belowbar, text="Buy")plotshape(StrongBuy,title="Strong Buy", color=color.green, style=shape.arrowup,location=location.belowbar, text="Strong Buy")plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="Sell")plotshape(StrongSell,title="Strong Sell", color=color.red, style=shape.arrowdown,text="Strong Sell")strategy.entry("GoGo Long", strategy.long, 1, when=vwaplong and vwapInput)strategy.entry("GoGo Short", strategy.short, 1, when=vwapshort and vwapInput)strategy.close("GoGo Long", when = vwapshort and vwapInput)strategy.close("GoGo Short", when = vwaplong and vwapInput)alertcondition(Buy, title="Buy Signal", message="Buy")alertcondition(Sell, title="Sell Signal", message="Sell")