Indicator · Pine Script v5 · Own pane

Log Volume + Bollinger Band

by suyons· code credited to syoungs

This indicator plots raw volume or dollar volume on a logarithmic or linear scale in a separate pane below the main chart.

View on GitHub

GitHub stars7on the repository
Pine versionv5runs as is
Lines of code73
Settings8inputs
LicenceNone statedfile: MPL-2.0
Last update4 months ago21 Jun 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

73 lines of Pine Script v5 from volume/04-volume-log10-bb.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

04-volume-log10-bb.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © syoungs
// @version=5

indicator("Log Volume + Bollinger Band", overlay=false, format=format.price, precision=2)

// Config
mult = str.contains(syminfo.prefix, "FX") or str.contains(syminfo.type, "forex") ? 100000 : str.contains(syminfo.ticker, "XAUUSD") ? 100 : syminfo.pointvalue
mult_str = math.log10(mult) >= 6 ? str.format("[{0,number,#.#}",mult/math.pow(10,6))+"M] " : math.log10(mult) >= 3 ? str.format("[{0,number,#.#}",mult/math.pow(10,3))+"K] " : str.format("[{0,number,#.#}] ",mult)
// currency = str.contains(syminfo.currency, "USD") ? "$" : str.contains(syminfo.currency, "USX") ? "¢" : str.contains(syminfo.currency, "EUR") ? "€" : str.contains(syminfo.currency, "JPY") ? "¥" : str.contains(syminfo.currency, "KRW") ? "₩" : str.contains(syminfo.currency, "INR") ? "₹" : str.contains(syminfo.currency, "BTC") ? "₿" : str.contains(syminfo.currency, "HKD") ? "HK$" : syminfo.currency + " "
currency = syminfo.currency + " "
pos_in = input.int(1, "Table Position", 1, 9, 1, inline="1", group="Table")
table_pos = switch pos_in
    1 => position.top_left
    2 => position.top_center
    3 => position.top_right
    4 => position.middle_left
    5 => position.middle_center
    6 => position.middle_right
    7 => position.bottom_left
    8 => position.bottom_center
    => position.bottom_right
usePrice = input.bool(true, "True = Vol × Price / False = Vol", inline="2", group="Table")
volPrice = volume*close*mult
vol = usePrice ? volPrice : volume
useLog = input.bool(true, "True = log10 Vol / False = Vol", inline="3", group="Table")
vol2 = useLog ? math.log10(vol) : vol

barColorsOnPrevVolume = input(title="True = Volume color / False = Price color", defval=true, inline="4", group="Table")
palette = barColorsOnPrevVolume ? (vol2[1] > vol2 ? #F1948A : #82E0AA) : (close[1] > close ? #F1948A : #82E0AA)

// Calculating bollinger bands
// +1σ -> 0.84     +2σ -> 0.97
vollen = input.int(120, "Length", 1, 1000, 1, inline="1", group="Bollinger Band")
typebb = input.string(title="Type", defval="HMA", inline="1", group="Bollinger Band", options = ["SMA", "EMA", "WMA", "HMA", "RMA", "VWMA", "ALMA"])

med = switch typebb
    "SMA" => ta.sma(vol2, vollen)
    "EMA" => ta.ema(vol2, vollen)
    "WMA" => ta.wma(vol2, vollen)
    "HMA" => ta.hma(vol2, vollen)
    "RMA" => ta.rma(vol2, vollen)
    "VWMA" => ta.vwma(vol2, vollen)
    "ALMA" => ta.alma(vol2, vollen, 1, 0)

dev = ta.stdev(vol2, vollen)
devmult_now = (vol2 - med) / dev
// devmult_string = str.format(" ({0}{1,number,#.#}σ)", devmult_now > 0 ? "+" : "", devmult_now)
// devmult_alert = input.float(2.0, "Alerts when stdev", 0, 9.9, 0.1, inline="5")
// alertcondition(ta.crossover(devmult_now,devmult_alert),title='',message='{{interval}} Volume alert')

devmult1 = input.float(2,"Upper", minval=-9.9, maxval=9.9, step=0.1, inline="2", group="Bollinger Band")
devmult2 = input.float(-2,"Lower", minval=-9.9, maxval=9.9, step=0.1, inline="2", group="Bollinger Band")

// Plot Bollinger band
plot(vol2, color = palette, style=plot.style_line, title="Volume", linewidth=1)
plot(med,"VolMA",color.new(#ffffff,50))
plot(med+devmult1*dev,"Upper",color.new(#f7525f,50))
plot(med+devmult2*dev,"Lower",color.new(#f7525f,50))

// Display volume in text
string value = na
if usePrice
    value := vol2 >= 12 ? str.format("{0,number,#.#}",volPrice/math.pow(10,12))+"T" : vol2 >= 9 ? str.format("{0,number,#.#}",volPrice/math.pow(10,9))+"B" : vol2 >= 6 ? str.format("{0,number,#.#}",volPrice/math.pow(10,6))+"M" : vol2 >= 3 ? str.format("{0,number,#.#}",volPrice/math.pow(10,3))+"K" : str.format("{0,number,#.#}",volPrice)
    // value := str.tostring(volPrice, format.volume)
else
    value := vol2 >= 12 ? str.format("{0,number,#.#}",volume/math.pow(10,12))+"T" : vol2 >= 9 ? str.format("{0,number,#.#}",volume/math.pow(10,9))+"B" : vol2 >= 6 ? str.format("{0,number,#.#}",volume/math.pow(10,6))+"M" : vol2 >= 3 ? str.format("{0,number,#.#}",volume/math.pow(10,3))+"K" : str.format("{0,number,#.#}",volume)
    // value := str.tostring(volOnly, format.volume)

if vol2 >= 0
    show = table.new(table_pos, 1, 1, color.black)
    // table.cell(show, 0, 0, mult_str + currency + value + devmult_string, 0, 0, text_color=palette)
    table.cell(show, 0, 0, mult_str + currency + value, 0, 0, text_color=palette)

Overview

Log Volume + Bollinger Band calculates Bollinger Bands around the chosen volume series using standard deviation and selectable moving average smoothing types, including Hull and exponential averages. Input settings allow users to adjust moving average lengths, standard deviation multipliers, moving average algorithms, table placement, and color-coding logic based on price or volume changes. As a standalone indicator, it does not provide automated trading signals, entry triggers, or trade execution rules.

Details

Published by

suyons on GitHub

Code credit

syoungs, as written in the script's header

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Volume, Volatility & bands

Markets

Forex, Gold

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Table Positionint1pos_in
True = Vol × Price / False = VolbooltrueusePrice
True = log10 Vol / False = VolbooltrueuseLog
True = Volume color / False = Price colorbooltruebarColorsOnPrevVolume
Lengthint120vollen
TypestringHMAtypebb
Upperfloat2devmult1
Lowerfloat-2devmult2
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

This indicator plots a Supertrend-based trend-following setup in a separate pane and skips conditions it treats as a sideways market. A volatility range is built from an ATR value, with RMA, SMA, EMA, or WMA smoothing, or from a fixed point distance. Optional

Indicator v5 TrendVolatility & bands
Updated 1 year ago · MPL-2.0 GitHub repository of Trend Following Setup - Sideways Market Skipper
114 stars

This indicator standardizes price inputs using z-score normalization before calculating a relative strength index (RSI). It generates trade signals when standardized price components cross over or under the standardized RSI feature. Signals can be filtered by

Indicator v4 Oscillators & momentumVolatility & bands Repaints
Updated 1 year ago · None stated GitHub repository of Preprosessed & Standardized RSI
99 stars

This script calculates Bill Williams' Market Facilitation Index (BW MFI) to evaluate price movement efficiency relative to trading volume. It computes the range between the high and low prices divided by volume for each bar, returning zero when volume is zero.

Indicator v6 VolumeVolatility & bands
Updated 4 weeks ago · Apache-2.0 GitHub repository of Market Facilitation Index (MARKETFI)

PPO ATR Bands

by cryptorife
75 stars

PPO ATR Bands plots a percentage price oscillator in a separate pane. It compares a Hull average of typical price with a volume-weighted exponential average of Parabolic SAR, then scales three true-range bands around the slow average into matching oscillator l

Indicator v4 Oscillators & momentumMoving averages
Updated 3 years ago · GPL-3.0 GitHub repository of PPO ATR Bands

This indicator combines Chaikin Money Flow (CMF), a SuperTrend baseline, and an Average True Range (ATR) calculation inside a separate sub-pane. It calculates a standard 20-period CMF plotted as a line and colored histogram columns around a zero baseline, trac

Indicator v6 TrendVolume
Updated 6 months ago · Apache-2.0 GitHub repository of Institutional View: CMF & SuperTrend

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers