Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Volatility Range Breakout Strategy [wbburgin]

A Pine Script v5 strategy built on Highest (source, length), Lowest (source, length) and Crossover (high, hb1). 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; defaults include Average Length 100, Volatility Length 100 and Volatility Source close.

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 Volatility Range Breakout Strategy [wbburgin] repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 1 of 1 trades.
How did Volatility Range Breakout Strategy [wbburgin] do on BTCUSDT 1D with default settings?
+294.92%
From 26 Jan 2024 to 21 Oct 2026, over 5 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
What alerts does Volatility Range Breakout Strategy [wbburgin] have?
4
Volatility Long Entry Signal; Volatility Long Exit Signal; Volatility Short Entry Signal; Volatility Short Exit Signal.
Does Volatility Range Breakout Strategy [wbburgin] 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: 5 before, 4 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 Volatility Range Breakout Strategy [wbburgin] use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.

BTCUSDT · 1D · default settings

  • Weighted Volatility Moving Average
  • Volatility Reversal Band - Top
  • Volatility Reversal Band - Bottom
  • 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)
50,00075,000100,000125,000150,000AprJulOct2025AprJulOct2026AprJulOct$39,495$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.
Net profit
+294.92%
$29,492.00
Buy and hold
+102.5%
same period
Closed trades
5
3 won · 2 lost
Profitable
60.0%
of closed trades
Profit factor
2.99
gross profit ÷ gross loss
Max drawdown
109.75%
−$16,602.10

One run with the author's default settings, $10,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.

  • Likely bug

    ta.crossover(high, hb1) ignores the settings line 30

    Line 30 hard-codes high where line 38 uses “Exit Source”. Changing those settings moves one band but not this one.

    ta.crossover(high,hb1)ta.crossover(cross_type, hb1)
  • Likely bug

    ta.crossunder(low, lb1) ignores the settings line 31

    Line 31 hard-codes low where line 35 uses “Exit Source”. Changing those settings moves one band but not this one.

    ta.crossunder(low,lb1)ta.crossunder(cross_type, lb1)
  • 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.

Settings

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

SettingDefaultType and rangeFeeds
Average Length100inthb1 lb1
Volatility Length100intvolatility
Volatility Sourceclosesourcevolatility
Exit Sourceclosesourcevlong_exit vshort_exit
Exit TypeVolatility MAstring · options ["Volatility MA","Range Crossover"]vlong_exit vshort_exit

What it calculates

  • Highestsource, lengthh · line 15
  • Lowestsource, lengthl · line 16
  • Crossoverhigh, hb1upcross · line 30
  • Crossunderlow, lb1dncross · line 31

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.

highhighprice datalowlowprice dataclosecloseprice datavolLenVolatility Lengthsetting · 100vm1Average Lengthsetting · 100exit_typeExit Typesetting · Volatility MAhHighest→ hlLowest→ lupcrossCrossover→ upcrossdncrossCrossunder→ dncrossnormnormvaluesumsumvaluevxvxvaluevolatilityvolatilityvaluehighband1, lowband1highband1 · lowband12 valueshb1hb1valuelb1lb1valuehlavghlavgvaluevlongvlongvaluevshortvshortvaluevlong_exitvlong_exitconditionvshort_exitvshort_exitconditionentry:LongOpen Longstrategy.entryclose:LongClose Longstrategy.closeentry:ShortOpen Shortstrategy.entryclose:ShortClose Shortstrategy.closeplot:48Weighted Volatility Mov…plotplot:49Volatility Reversal Ban…plotplot:50Volatility Reversal Ban…plotalertcondition:51Volatility Long Entry S…alertconditionalertcondition:52Volatility Long Exit Si…alertconditionalertcondition:53Volatility Short Entry …alertconditionalertcondition:54Volatility Short Exit S…alertconditionfill:55Fillfill

Order rules

OrderFires whenBy defaultLine
Open Long longvlongOn41
Close Longvlong_exitOn43
Open Short shortvshortOn45
Close Shortvshort_exitOn47

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

Alerts

AlertCallMessageLine
Volatility Long Entry Signalalertconditionno message51
Volatility Long Exit Signalalertconditionno message52
Volatility Short Entry Signalalertconditionno message53
Volatility Short Exit Signalalertconditionno message54

Does it repaint?

No

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

1/1trades 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+294.9%+102.5%560%2.99109.7%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+91.9%+5.5%250%13.4711.7%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−8.6%+9.8%10%0.0010.8%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+3.7%+8.4%367%12.121.8%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.3%+16.7%10%0.000.4%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.1%+21.5%650%3.050.1%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−7.1%+148.3%520%0.129.3%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+2.7%+17.1%3100%—0.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 market250%$5,127.76
Sideways market0—$0.00
Falling market367%$24,364.30

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

How bad could the drawdown be?

34.9%

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

0%40%
All 5 trades
SideEntryExitBarsP&L
long11 Nov 2024 80,370.0012 Feb 2025 95,778.2093$15,408.20
long17 Dec 2024 106,059.0012 Feb 2025 95,778.2057−$10,280.40
short19 Nov 2025 92,960.8017 Apr 2026 75,154.30149$17,806.60
short2 Dec 2025 86,286.0017 Apr 2026 75,154.30136$11,131.70
short7 Feb 2026 70,580.3017 Apr 2026 75,154.3069−$4,574.02

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
Volatility Range Breakout Strategy [wbburgin] this page—v5 strategy+294.9%5109.7%
Alex Days HiLo Rajib by 14rajibhighest lowestv4 strategyNo trades on this market
Donchian Strat EXMO by pskoroplashighest lowestv4 strategy+12.1%2268.0%
Average Highest High and Lowest Low Swinger Strategy by exlux99lowest highestv4 strategy+6.4%2049.6%
Highest High and Lowest Low Channel Strategy by ceyhunhighest lowestv5 strategy−3.7%267.9%
Donchian Channels System [racer8] by racer8highest lowestv4 strategy−3.2%3643.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.

  • No v6-only features. v6 is not needed to run this script.

Clean v5

Verified

Nothing to change.

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: 5 before, 4 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.

⋯// © wbburgin-//@version=5+//@version=6strategy("Volatility Range Breakout Strategy [wbburgin]", shorttitle = "VRB Strategy [wbburgin]", overlay=true,⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 19 msYes 1,000 bars in 334 msNot measured
PineTSNot testedNot testedNot 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("Volatility Range Breakout Strategy [wbburgin]", shorttitle = "VRB Strategy [wbburgin]", overlay=true, pyramiding=20,max_bars_back=2000,initial_capital=10000)wma(float priceType,int length,float weight) =>    norm = 0.0    sum = 0.0    for i = 0 to length - 1        norm := norm + weight        sum := sum + priceType[i] * weight    sum / norm// This definition of volatility uses the high-low range divided by the average of that range.volatility(source,length) =>    h = ta.highest(source,length)    l = ta.lowest(source,length)    vx = 2 * (h - l) / (h + l)    vxvm1 = input.int(100,"Average Length")volLen = input.int(100,"Volatility Length")vsrc = input.source(close,"Volatility Source")cross_type = input.source(close,"Exit Source")exit_type = input.string("Volatility MA",options=["Volatility MA","Range Crossover"],title="Exit Type")volatility = volatility(vsrc,volLen)highband1 = close + (close * volatility)lowband1 = close - (close * volatility)hb1 = wma(highband1,vm1,volatility)lb1 = wma(lowband1,vm1,volatility)hlavg = math.avg(hb1,lb1)upcross = ta.crossover(high,hb1)    //Crossing over the high band of historical volatility signifies a bullish breakoutdncross = ta.crossunder(low,lb1)    //Crossing under the low band of historical volatility signifies a bearish breakoutvlong = upcrossvshort = dncrossvlong_exit = switch    exit_type == "Volatility MA" => ta.crossunder(cross_type,hlavg)    exit_type == "Range Crossover" => ta.crossunder(cross_type,hb1)vshort_exit = switch    exit_type == "Volatility MA" => ta.crossover(cross_type,hlavg)    exit_type == "Range Crossover" => ta.crossover(cross_type,lb1)if vlong    strategy.entry("Long",strategy.long)if vlong_exit    strategy.close("Long")if vshort    strategy.entry("Short",strategy.short)if vshort_exit    strategy.close("Short")plot(hlavg,color=color.white,title="Weighted Volatility Moving Average")t = plot(hb1,color=color.new(color.red,50),title="Volatility Reversal Band - Top")b = plot(lb1,color=color.new(color.green,50),title="Volatility Reversal Band - Bottom")alertcondition(vlong,"Volatility Long Entry Signal")alertcondition(vlong_exit,"Volatility Long Exit Signal")alertcondition(vshort,"Volatility Short Entry Signal")alertcondition(vshort_exit,"Volatility Short Exit Signal")fill(t,b,color=color.new(color.aqua,90))