NEWCard payments are live · from $18/month, USDT also acceptedSee plans
COINPRED / STRATEGY LIBRARY

BTC Volatility Range Breakout: Long When the High Clears the Upper Band, Short When the Low Breaks the Lower Band

An open-source (MPL 2.0) breakout strategy by wbburgin. It builds upper and lower bands from a relative high-low volatility measure, then smooths those bands with an equal-length average. By default it goes long when the high crosses the upper band and short when the low crosses the lower band, and it exits on a close crossing the mid line. The author's chart is BINANCEUS:BTCUSD on the 15-minute timeframe. The rules below follow the source; this page invents no backtest figures.

Illustrated guidesPine Script®Included with monthly & annual plans
← All strategies
wbburgin · 1.0 · 2026-11-24 · Breakouts
BTC Volatility Range Breakout: Long When the High Clears the Upper Band, Short When the Low Breaks the Lower Band

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.

Author chart of the Volatility Range Breakout strategy on BINANCEUS:BTCUSD 15-minute, showing the bands, mid line, and trade marks
Author chart: BINANCEUS:BTCUSD (Binance US Bitcoin / U.S. Dollar), 15-minute timeframe, from the author's publication image. The volatility bands, mid line, and entry/exit marks are visible; this only shows the layout and is not a performance claim.

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)

InputDefaultRole
Average Length100Length of the simple average that smooths the raw upper and lower edges.
Volatility Length100Lookback used to compute the relative high-low range.
Volatility SourceclosePrice source for the volatility calculation.
Exit SourceclosePrice source used for the exit cross.
Exit TypeVolatility MAExit 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

  1. Download the .pine file from Coinpred (active membership required, see below), or check the original page for a newer version.
  2. Open the Pine Editor, create a blank script, paste the full source, and save.
  3. Click Add to chart. To match the author image, start with Binance US BTCUSD on the 15-minute timeframe.
  4. Check the two length inputs, the exit type, and the pyramid limit, then review fills in the Strategy Tester.
  5. 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.

Source, license and version

Mozilla Public License 2.0 (MPL 2.0),源码头注明 © wbburgin。再分发须保留原版权与许可声明;如修改源码文件,修改后的文件仍须按 MPL 2.0 提供。Coinpred 未修改源码。 / Licensed under MPL 2.0 per the source header, © wbburgin. Redistribution must keep the copyright and license notices; modified files must remain under MPL 2.0. Coinpred ships the unmodified source.

View original source ↗

Check the script license and your TradingView account features. Historical results do not guarantee future performance.

More strategies

All strategies →