The idea
This is wbburgin's open-source script, published as Volatility Range Breakout Strategy [wbburgin] (short title VRB Strategy [wbburgin]). It measures a relative high-low range, stretches a band around the current close by that amount, then smooths the raw edges into an upper band, a lower band, and a mid line. A breakout through a band opens a trade in that direction. The default exit is the close crossing back through the mid line.
The author's publication chart is BINANCEUS:BTCUSD on the 15-minute timeframe, so this entry is filed under BTC. The script does not hard-code a symbol, and it will load on other charts, but the write-up and the image follow that publication chart. One mismatch matters: the publication text describes breakouts with the closing price, while the source opens a long when the high crosses the upper band and a short when the low crosses the lower band. Everything below follows the source.

How the indicators are calculated
- Volatility: over Volatility Length (default 100) it takes the highest and lowest of the chosen source (close by default) and computes 2 × (high − low) / (high + low). That is a relative range, not ATR.
- Raw band: the upper edge is close + close × volatility; the lower edge is close − close × volatility. The width is therefore rebuilt from the current close and the current volatility reading.
- Smoothed bands: the source defines a function named wma, but the loop multiplies every lookback price by the same current-bar volatility. That weight cancels, so the result is a simple moving average of length Average Length (default 100) on each raw edge. The publication calls this a volatility-weighted average; under the default code it is an SMA. The smoothed bands are hb1 and lb1; the mid line hlavg is their arithmetic mean.
- Entries use crosses of the high or low against the smoothed bands, not the close. The default exit uses Exit Source (close by default) against the mid line.
- The strategy declaration sets pyramiding=20, so up to 20 entries can stack in the same direction. It does not set commission, slippage, or a percent-of-equity size; Pine's default is a fixed quantity of 1 per entry.
Entry rules
- Long (order name Long): the bar's high crosses above the smoothed upper band hb1.
- Short (order name Short): the bar's low crosses below the smoothed lower band lb1.
- A fresh signal places another entry in the same direction until 20 pyramid layers are filled. The source does not require a flat book, and it has no explicit long/short mutex. If both signals fired on the same bar, the script would process the long branch first, then the short branch.
- The source does not wait for barstate.isconfirmed. A high or low can register a cross before the bar closes; whether that fill stands depends on your TradingView order settings.
Exits and position size
- Default Exit Type is Volatility MA: a long is closed with strategy.close("Long") when Exit Source (close by default) crosses under the mid line hlavg; a short is closed when Exit Source crosses over that mid line. close exits the whole stack in that direction.
- If you switch Exit Type to Range Crossover, a long exits when Exit Source crosses under the upper band hb1, and a short exits when it crosses over the lower band lb1. The publication notes that the mid-line exit is meant to stay with a trend for longer.
- There is no take-profit, stop-loss, or time-based exit in the source.
- Size follows Pine's default of 1 unit per entry, with up to 20 layers. What that unit is worth changes with the symbol, so treat the quantity as something you must set yourself, not as a recommended risk size.
Inputs (source defaults)
| Input | Default | Role |
|---|---|---|
| Average Length | 100 | Length of the simple average that smooths the raw upper and lower edges. |
| Volatility Length | 100 | Lookback used to compute the relative high-low range. |
| Volatility Source | close | Price source for the volatility calculation. |
| Exit Source | close | Price source used for the exit cross. |
| Exit Type | Volatility MA | Exit on a mid-line cross, or switch to a band cross. |
Things to know before using it
- The publication describes close-based breakouts; the source enters on the high and the low. That changes when a signal can appear in both the tester and live trading.
- The function named wma is a simple moving average in this implementation, not a historically volatility-weighted average.
- Twenty pyramid layers and no stop can let a run of breakouts build a large position and a large drawdown.
- Commission and slippage are unset. On a 15-minute chart, real trading costs can make tester results look too optimistic.
- Both length inputs default to 100, which is about 25 hours on a 15-minute chart. Check how long those windows become before you change the timeframe.
Installing it on TradingView
- Download the .pine file from Coinpred (active membership required, see below), or check the original page for a newer version.
- Open the Pine Editor, create a blank script, paste the full source, and save.
- Click Add to chart. To match the author image, start with Binance US BTCUSD on the 15-minute timeframe.
- Check the two length inputs, the exit type, and the pyramid limit, then review fills in the Strategy Tester.
- Past tester results do not guarantee future returns.
About backtest figures
Source, license and version
- Source: https://www.tradingview.com/script/2cnPhDGs-Volatility-Range-Breakout-Strategy-wbburgin/
- Author: wbburgin. Source version 1.0 (Pine v5), scriptAccess=open_no_auth.
- License: Mozilla Public License 2.0. Redistribution must keep the copyright and license notices; modified files must remain under MPL 2.0. Coinpred ships the unmodified full source.
- Members can download the .pine file on this page to study the rules. Judge the risk yourself, and follow your venue's rules.



