Pine Script v4 · Strategy
Swing VWAP Weekly Stock and Crypto Strategy
A Pine Script v4 strategy with no technical-analysis calculation. 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 commits 100% of equity and pays 0.03% commission. It has no 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 Swing VWAP Weekly Stock and Crypto Strategy repaint?
- Yes
- In a live replay, it did not match history on 47 of 60 trades, and it produced 99 trades that history does not have.
- How did Swing VWAP Weekly Stock and Crypto Strategy do on BTCUSDT 1D with default settings?
- −10.66%
- From 26 Jan 2024 to 21 Oct 2026, over 189 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can Swing VWAP Weekly Stock and Crypto 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 Swing VWAP Weekly Stock and Crypto Strategy use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Swing VWAP Weekly Stock and Crypto Strategy run in Zeal Terminal?
- Yes
- It compiles in 6 ms and runs 1,000 bars in 22 ms, in the browser.
BTCUSDT · 1D · default settings
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- −10.66%
- −$10.66
- Buy and hold
- +102.5%
- same period
- Closed trades
- 189
- 59 won · 130 lost
- Profitable
- 31.2%
- of closed trades
- Profit factor
- 0.97
- gross profit ÷ gross loss
- Max drawdown
- 46.32%
- −$76.47
One run with the author's default settings, $100 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.
-
Check
No stop loss
Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.
-
Check
Every trade uses all the equity
default_qty_value is 100% of equity.
-
Note
Uses an argument v6 removed
when = on line 8, 9, 10, 11. The upgraded version below moves each call inside an if block.
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 security → request.security.
- 4 strategy calls use the when = argument (line 8, 9, 10, 11). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
v4 → v5
VerifiedSame 189 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 3: //@version=4 → //@version=5
- Line 5: security → request.security
- Line 5: vwap → ta.vwap
⋯// © exlux99-//@version=4+//@version=5strategy(title = "Swing VWAP Weekly Strategy", overlay = true, pyramiding=1,initial_capital = 100, default_qty_type= strategy.percent_of_equity, default_qty_value = 100, calc_on_order_fills=false, slippage=0,commission_type=strategy.commission.percent,commission_value=0.03)-vwapweekly= security(syminfo.tickerid, "W", vwap)+vwapweekly= request.security(syminfo.tickerid, "W", ta.vwap)long=( close > vwapweekly)⋯Same 189 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 8: when = long → if block
- Line 9: when = close < vwapweekly or vwapweekly[1] > vwapweekly → if block
- Line 10: when = short → if block
- Line 11: when = close > vwapweekly or vwapweekly > vwapweekly[1] → if block
⋯short=( close < vwapweekly)-strategy.entry("long", strategy.long,when=long, comment = "long")+if long+ strategy.entry("long", strategy.long, comment = "long")-strategy.close("long",when=close < vwapweekly or vwapweekly[1] > vwapweekly)+if close < vwapweekly or vwapweekly[1] > vwapweekly+ strategy.close("long")-strategy.entry("short", strategy.short,when=short, comment = "short")+if short+ strategy.entry("short", strategy.short, comment = "short")-strategy.close("short",when=close > vwapweekly or vwapweekly > vwapweekly[1])+if close > vwapweekly or vwapweekly > vwapweekly[1]+ 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: 189 before, 585 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.
⋯// © exlux99-//@version=5+//@version=6strategy(title = "Swing VWAP Weekly Strategy", overlay = true, pyramiding=1,initial_capital = 100, default_qty_type= strategy.percent_of_equity, default_qty_value = 100, calc_on_order_fills=false, slippage=0,commission_type=strategy.commission.percent,commission_value=0.03)⋯Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
The script declares no settings.
What it calculates
No technical-analysis calculation: the script works on prices and settings directly.
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.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open long long | long( close > vwapweekly) | On | 8 |
| Close long | close < vwapweekly or vwapweekly[1] > vwapweekly | On | 9 |
| Open short short | short( close < vwapweekly) | On | 10 |
| Close short | close > vwapweekly or vwapweekly > vwapweekly[1] | On | 11 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Does it repaint?
Yes
The live replay did not match history.
- ClearHigher-timeframe data1 security call(s), none with lookahead on.
- 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.
| Market | Net | Buy and hold | Trades | Won | Profit factor | Max drawdown | Period |
|---|---|---|---|---|---|---|---|
| BTCUSDT 1D | −10.7% | +102.5% | 189 | 31% | 0.97 | 46.3% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | +8.3% | +5.5% | 66 | 24% | 1.14 | 13.9% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +69.1% | +9.8% | 176 | 35% | 1.10 | 50.4% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | +12.7% | +8.4% | 74 | 19% | 1.15 | 26.9% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | −10.4% | +16.7% | 187 | 33% | 0.98 | 62.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | +8.0% | +21.5% | 87 | 16% | 1.08 | 23.2% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +95.1% | +148.3% | 168 | 36% | 1.20 | 34.2% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | +1.3% | +17.1% | 67 | 21% | 1.02 | 17.2% | 8 May 2026 – 21 Oct 2026 |
Higher-timeframe data for request.security(): BINANCE:BTCUSDT W (Binance BTCUSDT 1w), fetched from Binance's public market data for each market.
Backtests are simulations on historical data and are not investment advice.
The trades
By market direction
| At entry, last 90 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 67 | 30% | −$42.39 |
| Sideways market | 75 | 39% | $61.48 |
| Falling market | 47 | 21% | −$29.73 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
64.9%
The 95th percentile of the worst drawdown when the same 189 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 36.9% to 64.9%; the tick is what actually happened, 45.9%. Order luck alone moves it this much.
The first 150 of 189 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 27 Jan 2024 41,823.50 | 29 Jan 2024 42,031.10 | 2 | $0.44 |
| long | 30 Jan 2024 43,302.70 | 5 Feb 2024 42,582.90 | 6 | −$1.73 |
| short | 5 Feb 2024 42,582.90 | 7 Feb 2024 43,099.00 | 2 | −$1.26 |
| long | 7 Feb 2024 43,099.00 | 24 Feb 2024 50,744.20 | 17 | $17.22 |
| short | 24 Feb 2024 50,744.20 | 25 Feb 2024 51,568.20 | 1 | −$1.93 |
| long | 25 Feb 2024 51,568.20 | 26 Feb 2024 51,728.80 | 1 | $0.28 |
| short | 26 Feb 2024 51,728.80 | 27 Feb 2024 54,476.50 | 1 | −$6.07 |
| long | 27 Feb 2024 54,476.50 | 17 Mar 2024 65,300.60 | 19 | $21.18 |
| short | 17 Mar 2024 65,300.60 | 18 Mar 2024 68,393.50 | 1 | −$6.15 |
| short | 19 Mar 2024 67,610.00 | 25 Mar 2024 67,210.00 | 6 | $0.65 |
| long | 25 Mar 2024 67,210.00 | 2 Apr 2024 69,649.80 | 8 | $4.38 |
| short | 2 Apr 2024 69,649.80 | 8 Apr 2024 69,360.40 | 6 | $0.45 |
| long | 8 Apr 2024 69,360.40 | 13 Apr 2024 67,116.50 | 5 | −$4.20 |
| short | 13 Apr 2024 67,116.50 | 22 Apr 2024 64,941.20 | 9 | $3.92 |
| long | 22 Apr 2024 64,941.20 | 27 Apr 2024 63,770.00 | 5 | −$2.37 |
| short | 27 Apr 2024 63,770.00 | 29 Apr 2024 63,118.60 | 2 | $1.20 |
| short | 30 Apr 2024 63,866.00 | 6 May 2024 64,012.00 | 6 | −$0.36 |
| long | 6 May 2024 64,012.00 | 9 May 2024 61,193.00 | 3 | −$5.61 |
| short | 9 May 2024 61,193.00 | 10 May 2024 63,074.00 | 1 | −$3.76 |
| long | 10 May 2024 63,074.00 | 11 May 2024 60,800.00 | 1 | −$4.26 |
| short | 11 May 2024 60,800.00 | 13 May 2024 61,484.00 | 2 | −$1.33 |
| long | 14 May 2024 62,940.10 | 15 May 2024 61,577.50 | 1 | −$2.46 |
| short | 15 May 2024 61,577.50 | 16 May 2024 66,206.50 | 1 | −$8.20 |
| long | 16 May 2024 66,206.50 | 27 May 2024 68,507.70 | 11 | $3.42 |
| short | 27 May 2024 68,507.70 | 28 May 2024 69,436.40 | 1 | −$1.46 |
| long | 28 May 2024 69,436.40 | 29 May 2024 68,398.40 | 1 | −$1.59 |
| short | 29 May 2024 68,398.40 | 4 Jun 2024 68,809.90 | 6 | −$0.66 |
| long | 4 Jun 2024 68,809.90 | 10 Jun 2024 69,648.10 | 6 | $1.15 |
| short | 10 Jun 2024 69,648.10 | 1 Jul 2024 62,772.00 | 21 | $9.90 |
| long | 1 Jul 2024 62,772.00 | 4 Jul 2024 60,208.60 | 3 | −$4.59 |
| short | 4 Jul 2024 60,208.60 | 10 Jul 2024 58,050.00 | 6 | $3.74 |
| long | 10 Jul 2024 58,050.00 | 11 Jul 2024 57,725.80 | 1 | −$0.68 |
| short | 11 Jul 2024 57,725.80 | 13 Jul 2024 57,889.10 | 2 | −$0.37 |
| long | 13 Jul 2024 57,889.10 | 25 Jul 2024 65,376.00 | 12 | $14.01 |
| short | 25 Jul 2024 65,376.00 | 26 Jul 2024 65,799.90 | 1 | −$0.87 |
| long | 26 Jul 2024 65,799.90 | 30 Jul 2024 66,784.70 | 4 | $1.75 |
| short | 30 Jul 2024 66,784.70 | 12 Aug 2024 58,712.60 | 13 | $14.89 |
| long | 12 Aug 2024 58,712.60 | 19 Aug 2024 58,427.30 | 7 | −$0.76 |
| short | 19 Aug 2024 58,427.30 | 20 Aug 2024 59,438.50 | 1 | −$2.47 |
| long | 20 Aug 2024 59,438.50 | 28 Aug 2024 59,415.00 | 8 | −$0.13 |
| short | 28 Aug 2024 59,415.00 | 10 Sep 2024 57,042.00 | 13 | $5.32 |
| long | 10 Sep 2024 57,042.00 | 1 Oct 2024 63,327.60 | 21 | $15.41 |
| short | 1 Oct 2024 63,327.60 | 7 Oct 2024 62,819.90 | 6 | $1.16 |
| long | 7 Oct 2024 62,819.90 | 8 Oct 2024 62,224.00 | 1 | −$1.59 |
| short | 8 Oct 2024 62,224.00 | 13 Oct 2024 63,206.20 | 5 | −$2.55 |
| long | 13 Oct 2024 63,206.20 | 14 Oct 2024 62,870.00 | 1 | −$0.91 |
| long | 15 Oct 2024 66,084.00 | 24 Oct 2024 66,668.60 | 9 | $1.25 |
| short | 24 Oct 2024 66,668.60 | 25 Oct 2024 68,198.30 | 1 | −$3.61 |
| long | 25 Oct 2024 68,198.30 | 26 Oct 2024 66,698.30 | 1 | −$3.38 |
| short | 26 Oct 2024 66,698.30 | 27 Oct 2024 67,092.80 | 1 | −$0.95 |
| long | 27 Oct 2024 67,092.80 | 4 Nov 2024 68,776.00 | 8 | $3.56 |
| short | 4 Nov 2024 68,776.00 | 7 Nov 2024 75,572.00 | 3 | −$14.82 |
| long | 7 Nov 2024 75,572.00 | 26 Nov 2024 93,010.00 | 19 | $30.88 |
| short | 26 Nov 2024 93,010.00 | 28 Nov 2024 95,863.10 | 2 | −$5.16 |
| long | 28 Nov 2024 95,863.10 | 2 Dec 2024 97,185.20 | 4 | $2.11 |
| long | 3 Dec 2024 95,840.60 | 10 Dec 2024 97,276.50 | 7 | $2.33 |
| short | 10 Dec 2024 97,276.50 | 12 Dec 2024 101,125.00 | 2 | −$6.60 |
| long | 12 Dec 2024 101,125.00 | 19 Dec 2024 100,204.00 | 7 | −$1.53 |
| short | 19 Dec 2024 100,204.00 | 25 Dec 2024 98,663.60 | 6 | $2.31 |
| long | 25 Dec 2024 98,663.60 | 27 Dec 2024 95,791.60 | 2 | −$4.71 |
| short | 27 Dec 2024 95,791.60 | 3 Jan 2025 96,984.80 | 7 | −$2.01 |
| long | 3 Jan 2025 96,984.80 | 9 Jan 2025 95,060.60 | 6 | −$3.10 |
| short | 9 Jan 2025 95,060.60 | 15 Jan 2025 96,560.90 | 6 | −$2.44 |
| long | 15 Jan 2025 96,560.90 | 27 Jan 2025 102,620.00 | 12 | $9.09 |
| short | 27 Jan 2025 102,620.00 | 31 Jan 2025 104,723.00 | 4 | −$3.28 |
| long | 31 Jan 2025 104,723.00 | 1 Feb 2025 102,430.00 | 1 | −$3.42 |
| short | 1 Feb 2025 102,430.00 | 4 Feb 2025 101,329.00 | 3 | $1.51 |
| long | 4 Feb 2025 101,329.00 | 5 Feb 2025 97,763.10 | 1 | −$5.37 |
| short | 5 Feb 2025 97,763.10 | 11 Feb 2025 97,430.80 | 6 | $0.41 |
| long | 11 Feb 2025 97,430.80 | 12 Feb 2025 95,778.20 | 1 | −$2.55 |
| short | 12 Feb 2025 95,778.20 | 13 Feb 2025 97,870.00 | 1 | −$3.20 |
| long | 13 Feb 2025 97,870.00 | 14 Feb 2025 96,608.10 | 1 | −$1.88 |
| short | 14 Feb 2025 96,608.10 | 15 Feb 2025 97,500.50 | 1 | −$1.35 |
| long | 15 Feb 2025 97,500.50 | 17 Feb 2025 96,118.10 | 2 | −$2.01 |
| short | 17 Feb 2025 96,118.10 | 20 Feb 2025 96,644.40 | 3 | −$0.82 |
| long | 20 Feb 2025 96,644.40 | 22 Feb 2025 96,182.00 | 2 | −$0.72 |
| short | 22 Feb 2025 96,182.00 | 23 Feb 2025 96,551.00 | 1 | −$0.59 |
| long | 23 Feb 2025 96,551.00 | 24 Feb 2025 96,258.00 | 1 | −$0.48 |
| short | 24 Feb 2025 96,258.00 | 3 Mar 2025 94,270.00 | 7 | $2.64 |
| long | 3 Mar 2025 94,270.00 | 4 Mar 2025 86,221.20 | 1 | −$11.54 |
| short | 4 Mar 2025 86,221.20 | 6 Mar 2025 90,606.00 | 2 | −$6.32 |
| long | 6 Mar 2025 90,606.00 | 8 Mar 2025 86,801.70 | 2 | −$4.96 |
| short | 8 Mar 2025 86,801.70 | 17 Mar 2025 82,574.50 | 9 | $5.36 |
| long | 17 Mar 2025 82,574.50 | 29 Mar 2025 84,424.40 | 12 | $2.55 |
| short | 29 Mar 2025 84,424.40 | 2 Apr 2025 85,158.40 | 4 | −$1.11 |
| long | 2 Apr 2025 85,158.40 | 3 Apr 2025 82,516.30 | 1 | −$3.74 |
| short | 3 Apr 2025 82,516.30 | 10 Apr 2025 82,615.20 | 7 | −$0.21 |
| long | 10 Apr 2025 82,615.20 | 11 Apr 2025 79,607.30 | 1 | −$4.23 |
| short | 11 Apr 2025 79,607.30 | 12 Apr 2025 83,423.80 | 1 | −$5.34 |
| long | 12 Apr 2025 83,423.80 | 5 May 2025 94,277.60 | 23 | $13.56 |
| short | 5 May 2025 94,277.60 | 7 May 2025 96,834.00 | 2 | −$3.28 |
| long | 7 May 2025 96,834.00 | 30 May 2025 105,590.00 | 23 | $10.33 |
| short | 30 May 2025 105,590.00 | 9 Jun 2025 105,734.00 | 10 | −$0.25 |
| long | 9 Jun 2025 105,734.00 | 16 Jun 2025 105,594.00 | 7 | −$0.24 |
| short | 16 Jun 2025 105,594.00 | 17 Jun 2025 106,795.00 | 1 | −$1.49 |
| long | 17 Jun 2025 106,795.00 | 18 Jun 2025 104,551.00 | 1 | −$2.66 |
| short | 18 Jun 2025 104,551.00 | 24 Jun 2025 105,334.00 | 6 | −$0.98 |
| long | 24 Jun 2025 105,334.00 | 8 Jul 2025 108,263.00 | 14 | $3.26 |
| short | 8 Jul 2025 108,263.00 | 9 Jul 2025 108,923.00 | 1 | −$0.82 |
| long | 9 Jul 2025 108,923.00 | 21 Jul 2025 117,265.00 | 12 | $9.28 |
| short | 21 Jul 2025 117,265.00 | 23 Jul 2025 119,954.00 | 2 | −$3.09 |
| long | 23 Jul 2025 119,954.00 | 25 Jul 2025 118,341.00 | 2 | −$1.80 |
| short | 25 Jul 2025 118,341.00 | 28 Jul 2025 119,416.00 | 3 | −$1.23 |
| long | 28 Jul 2025 119,416.00 | 29 Jul 2025 118,062.00 | 1 | −$1.49 |
| short | 29 Jul 2025 118,062.00 | 8 Aug 2025 117,472.00 | 10 | $0.54 |
| long | 8 Aug 2025 117,472.00 | 18 Aug 2025 117,405.00 | 10 | −$0.15 |
| short | 18 Aug 2025 117,405.00 | 3 Sep 2025 111,240.00 | 16 | $6.45 |
| long | 3 Sep 2025 111,240.00 | 22 Sep 2025 115,232.00 | 19 | $4.61 |
| short | 22 Sep 2025 115,232.00 | 29 Sep 2025 112,164.00 | 7 | $3.52 |
| long | 29 Sep 2025 112,164.00 | 11 Oct 2025 112,774.00 | 12 | $0.67 |
| short | 11 Oct 2025 112,774.00 | 13 Oct 2025 114,959.00 | 2 | −$2.79 |
| long | 13 Oct 2025 114,959.00 | 15 Oct 2025 113,028.00 | 2 | −$2.38 |
| short | 15 Oct 2025 113,028.00 | 21 Oct 2025 110,532.00 | 6 | $2.89 |
| long | 21 Oct 2025 110,532.00 | 22 Oct 2025 108,298.00 | 1 | −$2.85 |
| short | 22 Oct 2025 108,298.00 | 24 Oct 2025 110,078.00 | 2 | −$2.29 |
| long | 24 Oct 2025 110,078.00 | 30 Oct 2025 110,021.00 | 6 | −$0.15 |
| short | 30 Oct 2025 110,021.00 | 11 Nov 2025 106,011.00 | 12 | $4.73 |
| long | 11 Nov 2025 106,011.00 | 12 Nov 2025 103,059.00 | 1 | −$3.88 |
| short | 12 Nov 2025 103,059.00 | 25 Nov 2025 88,300.00 | 13 | $18.93 |
| long | 25 Nov 2025 88,300.00 | 26 Nov 2025 87,370.00 | 1 | −$1.69 |
| short | 26 Nov 2025 87,370.00 | 27 Nov 2025 90,484.00 | 1 | −$5.44 |
| long | 27 Nov 2025 90,484.00 | 2 Dec 2025 86,286.00 | 5 | −$6.79 |
| short | 2 Dec 2025 86,286.00 | 3 Dec 2025 91,277.90 | 1 | −$8.05 |
| long | 3 Dec 2025 91,277.90 | 6 Dec 2025 89,330.00 | 3 | −$2.84 |
| short | 6 Dec 2025 89,330.00 | 8 Dec 2025 90,395.30 | 2 | −$1.59 |
| long | 8 Dec 2025 90,395.30 | 15 Dec 2025 88,172.20 | 7 | −$3.15 |
| short | 15 Dec 2025 88,172.20 | 22 Dec 2025 88,658.90 | 7 | −$0.75 |
| long | 22 Dec 2025 88,658.90 | 24 Dec 2025 87,486.00 | 2 | −$1.68 |
| short | 24 Dec 2025 87,486.00 | 28 Dec 2025 87,877.00 | 4 | −$0.61 |
| long | 28 Dec 2025 87,877.00 | 29 Dec 2025 87,952.70 | 1 | $0.03 |
| short | 29 Dec 2025 87,952.70 | 31 Dec 2025 88,485.50 | 2 | −$0.79 |
| long | 31 Dec 2025 88,485.50 | 1 Jan 2026 87,648.20 | 1 | −$1.19 |
| short | 1 Jan 2026 87,648.20 | 2 Jan 2026 88,839.10 | 1 | −$1.66 |
| long | 2 Jan 2026 88,839.10 | 12 Jan 2026 91,013.70 | 10 | $2.76 |
| short | 12 Jan 2026 91,013.70 | 14 Jan 2026 95,414.00 | 2 | −$5.79 |
| long | 14 Jan 2026 95,414.00 | 19 Jan 2026 93,673.10 | 5 | −$2.12 |
| short | 19 Jan 2026 93,673.10 | 28 Jan 2026 89,250.00 | 9 | $5.14 |
| long | 28 Jan 2026 89,250.00 | 30 Jan 2026 84,650.20 | 2 | −$6.02 |
| short | 30 Jan 2026 84,650.20 | 9 Feb 2026 70,330.40 | 10 | $18.45 |
| long | 9 Feb 2026 70,330.40 | 11 Feb 2026 68,841.30 | 2 | −$2.78 |
| short | 11 Feb 2026 68,841.30 | 16 Feb 2026 68,832.60 | 5 | −$0.06 |
| long | 16 Feb 2026 68,832.60 | 18 Feb 2026 67,503.50 | 2 | −$2.49 |
| short | 18 Feb 2026 67,503.50 | 26 Feb 2026 67,988.00 | 8 | −$0.95 |
| long | 26 Feb 2026 67,988.00 | 27 Feb 2026 67,485.20 | 1 | −$0.97 |
| short | 27 Feb 2026 67,485.20 | 3 Mar 2026 68,830.10 | 4 | −$2.48 |
| long | 3 Mar 2026 68,830.10 | 9 Mar 2026 65,971.20 | 6 | −$4.98 |
| short | 9 Mar 2026 65,971.20 | 10 Mar 2026 68,432.20 | 1 | −$4.29 |
| long | 10 Mar 2026 68,432.20 | 20 Mar 2026 69,930.00 | 10 | $2.32 |
| short | 20 Mar 2026 69,930.00 | 24 Mar 2026 70,906.40 | 4 | −$1.62 |
| long | 24 Mar 2026 70,906.40 | 27 Mar 2026 68,820.30 | 3 | −$3.29 |
Similar scripts
No other indicator or strategy here shares enough of its calculations.
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 6 ms | With a workaround 1,000 bars in 22 ms | Not measured |
| PineTS | No v5 and v6 only | — | Not 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. 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/// © exlux99//@version=4strategy(title = "Swing VWAP Weekly Strategy", overlay = true, pyramiding=1,initial_capital = 100, default_qty_type= strategy.percent_of_equity, default_qty_value = 100, calc_on_order_fills=false, slippage=0,commission_type=strategy.commission.percent,commission_value=0.03)vwapweekly= security(syminfo.tickerid, "W", vwap)long=( close > vwapweekly)short=( close < vwapweekly)strategy.entry("long", strategy.long,when=long, comment = "long")strategy.close("long",when=close < vwapweekly or vwapweekly[1] > vwapweekly)strategy.entry("short", strategy.short,when=short, comment = "short")strategy.close("short",when=close > vwapweekly or vwapweekly > vwapweekly[1])