Pine Script v5 · Strategy
Volume-Weighted Supertrend Strategy [wbburgin]
A Pine Script v5 strategy built on ATR (10). It has 2 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 5% of equity and pays 0.08 commission. 7 settings; defaults include Source close, ATR Period 10 and Volume Length 10.
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 Volume-Weighted Supertrend Strategy [wbburgin] repaint?
- No
- No repainting patterns were found in the source.
- Does Volume-Weighted Supertrend Strategy [wbburgin] run in Pine Script v6?
- Not tested
- The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L6:C0: no source was supplied for the library 'wbburgin/wbburgin_utils/2'. Libraries cannot be fetched from TradingView; supply the source in the 'libraries' option. No libraries were supplied.), so this step could not be checked. The v6 version is shown for reference and is not offered as a download.
- Does Volume-Weighted Supertrend Strategy [wbburgin] use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Volume-Weighted Supertrend Strategy [wbburgin] run in Zeal Terminal?
- No
- Not yet: it imports the library wbburgin/wbburgin_utils/2, whose source is not available here, so it does not run here
Review
What a careful reader of this script would point out, found by checking the source.
-
Check
No stop loss
Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.
-
Note
No slippage
Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.
Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Show Strategy Entries and Exits | false | bool | entry Long close Long line 51 line 53 |
| Source | close | source | sumPriceVolume upperBand lowerBand supertrend dir in_rising_trend |
| ATR Period | 10 | int | atr supertrend dir |
| Volume Length | 10 | int | supertrend dir volume_supertrend volume_direction |
| ATR Multiplier | 3.0 | float | upperBand lowerBand supertrend dir volume_supertrend volume_direction |
| Highlighting | true | bool | fill |
| Labels | true | bool | Supertrend Buy Label Supertrend Sell Label |
What it calculates
- ATRATR Period (10)
atr · line 8
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 | buyconditions and showStrategy | On | 52 |
| Close Long | sellconditions and showStrategy | On | 54 |
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.
The live replay needs a run, and this script does not run in Zeal Terminal yet; the answer comes from the checks on the source alone.
- 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.
Similar scripts
Indicators and strategies built from the same calculations.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| SOJA PIVOT by ParaBellum68 | atr | v4 strategy | +3.3% | 9 | 18.2% |
| Volatility System by EduardoMattje | atr | v5 strategy | +150.2% | 2 | 21.5% |
| ATR Stop Buy Strategy by phobo3s | atr | v4 strategy | No trades on this market | ||
| VBand Strategy by Saravanan_Ragavan | atr | v4 strategy | No trades on this market | ||
| Volatility Breakout Strategy [Angel Algo] by AngelAlgo | atr | v5 strategy | +3.1% | 18 | 3.6% |
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.
- 1 setting uses the untyped input() (line 32). 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
Not verifiedThe v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L6:C0: no source was supplied for the library 'wbburgin/wbburgin_utils/2'. Libraries cannot be fetched from TradingView; supply the source in the 'libraries' option. No libraries were supplied.), so this step could not be checked.
- Line 32: input() → input.bool()
⋯ [superTrend, direction]-showStrategy = input(false, title="Show Strategy Entries and Exits")+showStrategy = input.bool(false, title="Show Strategy Entries and Exits")src = input.source(close,"Source")⋯Does it run in Pine Script v6?
Not tested
The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L6:C0: no source was supplied for the library 'wbburgin/wbburgin_utils/2'. Libraries cannot be fetched from TradingView; supply the source in the 'libraries' option. No libraries were supplied.), so this step could not be checked. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © wbburgin-//@version=5+//@version=6strategy("Volume-Weighted Supertrend Strategy [wbburgin]", overlay=true, pyramiding=5,default_qty_type = strategy.percent_of_equity, ⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | No It imports the library wbburgin/wbburgin_utils/2, whose source is not available here, so it does not run here | Not measured | |
| PineTS | Not tested | Not tested | 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.
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/// © wbburgin//@version=5strategy("Volume-Weighted Supertrend Strategy [wbburgin]", overlay=true, pyramiding=5,default_qty_type = strategy.percent_of_equity, default_qty_value = 5, commission_value = 0.08, initial_capital = 100000)import wbburgin/wbburgin_utils/2 as uvwsupertrend(src, length, factor, atrPeriod) => atr = ta.atr(atrPeriod) sumPriceVolume = 0.0 sumVolume = 0.0 for i = 0 to length - 1 sumPriceVolume += src[i] * volume[i] sumVolume += volume[i] vwap = sumPriceVolume / sumVolume upperBand = vwap + factor * atr lowerBand = vwap - factor * atr prevLowerBand = nz(lowerBand[1]) prevUpperBand = nz(upperBand[1]) lowerBand := lowerBand > prevLowerBand or src[1] < prevLowerBand ? lowerBand : prevLowerBand upperBand := upperBand < prevUpperBand or src[1] > prevUpperBand ? upperBand : prevUpperBand int direction = na float superTrend = na prevSuperTrend = superTrend[1] if na(atr[1]) direction := 1 else if prevSuperTrend == prevUpperBand direction := close > upperBand ? -1 : 1 else direction := close < lowerBand ? 1 : -1 superTrend := direction == -1 ? lowerBand : upperBand [superTrend, direction]showStrategy = input(false, title="Show Strategy Entries and Exits")src = input.source(close,"Source")atrPeriod = input.int(10,"ATR Period")volPeriod = input.int(10,"Volume Length")factor = input.float(3.0,"ATR Multiplier")highlighting = input.bool(true,"Highlighting")labels = input.bool(true,"Labels")[supertrend,dir] = vwsupertrend(src, volPeriod, factor, atrPeriod)supertrend_up = dir == -1 ? supertrend : nasupertrend_dn = dir == 1 ? supertrend : nasupertrend_up_start = dir == -1 and dir[1] == 1 ? supertrend : nasupertrend_dn_start = dir == 1 and dir[1] == -1 ? supertrend : nain_rising_trend = supertrend < src[volume_supertrend,volume_direction] = u.supertrend_anysource(volume,factor,volPeriod)volume_supertrend_change_up = volume_direction[1] == 1 and volume_direction == -1volume_supertrend_change_dn = volume_direction[1] == -1 and volume_direction == 1in_rising_volume = volume_supertrend < volumebuyconditions = (in_rising_volume and supertrend_up_start) or (volume_supertrend_change_up and in_rising_trend)sellconditions = not in_rising_volume and supertrend_dn_start or (volume_supertrend_change_dn and not in_rising_trend)if buyconditions and showStrategy strategy.entry("Long",strategy.long)if sellconditions and showStrategy strategy.close("Long")changeColor = volume_supertrend_change_dn ? color.orange : volume_supertrend_change_up ? color.yellow : nalinecolor = switch dir == -1 and in_rising_volume => color.green dir == 1 and in_rising_volume => color.red dir == -1 and not in_rising_volume => color.new(color.blue,50) dir == 1 and not in_rising_volume => color.new(color.orange,50)fillcolor = switch dir == -1 and in_rising_volume => color.new(color.green,88) dir == 1 and in_rising_volume => color.new(color.red,88) dir == -1 and not in_rising_volume => color.new(color.blue,94) dir == 1 and not in_rising_volume => color.new(color.orange,94)sup = plot(supertrend_up,title="Up Supertrend",color=linecolor,style=plot.style_linebr,linewidth=2)sdn = plot(supertrend_dn,title="Down Supertrend",color=linecolor,style=plot.style_linebr,linewidth=2)mid = plot(hl2,color=na,title="HL2 (for Highlighting)")plotshape(supertrend_up_start,title="Supertrend Up Start",style=shape.circle,location=location.absolute, color=linecolor, size=size.tiny)plotshape(supertrend_dn_start,title="Supertrend Down Start",style=shape.circle,location=location.absolute, color=linecolor, size=size.tiny)plotshape(labels==false?na:buyconditions ? supertrend : na,title="Supertrend Buy Label",style=shape.labelup,location=location.absolute, color=color.green,textcolor=color.white,text = "Buy")plotshape(labels==false?na:sellconditions ? supertrend : na,title="Supertrend Sell Label",style=shape.labeldown,location=location.absolute, color=color.red,textcolor=color.white,text = "Sell")fill(sup,mid,highlighting==true ? fillcolor : na)fill(sdn,mid,highlighting==true ? fillcolor : na)