Indicator · Pine Script v5 · On the chart

Trading Volume Table

by suyons· code credited to syoungs

The script displays a table on the price chart showing current trading volume, optionally multiplied by close price and converted to T/B/M/K units based on magnitude.

View on GitHub

GitHub stars7on the repository
Pine versionv5runs as is
Lines of code50
Settings5inputs
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

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

02-trading-volume-table.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("Trading Volume Table", overlay=true, format=format.volume, precision=0)

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")
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")
volPrice = volume*close*mult
vol = usePrice ? volPrice : volume
useLog = input.bool(true, "True = log10 Vol / False = Vol (To calculate stdev)", inline="3")
vol2 = useLog ? math.log10(vol) : vol

// Statistics : calculating median & upper values
// 2 to 0.97 - 1 to 0.84
vollen = input.int(500, "Number of bars to count", 1, 1000, 1, inline="4")
med = ta.sma(vol2, vollen)
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 mult cross over (E+σ1)", 0, 9.9, 0.1, inline="5")
alertcondition(ta.crossover(devmult_now,devmult_alert),title='',message='{{interval}} Volume alert')
// +1σ = 0.84     +2σ = 0.97

// 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=open<close?#82E0AA:#F1948A)

Overview

Trading Volume Table computes median and standard deviation of volume over the last 500 bars by default, displaying deviation in sigmas from the mean. The table position is user-selectable, and alerts fire when the deviation crosses a threshold. Volume can be log-scaled for stdev calculation. It draws directly on the main chart pane without separate windows or strategy exits.

Details

Published by

suyons on GitHub

Code credit

syoungs, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Volume, Screeners & dashboards

Markets

Any symbol

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 = Vol (To calculate stdev)booltrueuseLog
Number of bars to countint500vollen
Alerts when Stdev mult cross over (E+σ1)float2.0devmult_alert
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 overlay indicator screens a pasted list of up to forty symbols and draws a table on the price chart. It classifies bullish or bearish setups from the percent change between the current candle and the candle 250 bars back, then shows RSI with a simple movi

Indicator v5 Oscillators & momentumVolume
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum Setup - Ankush Bajaj Momentum Investing Setup

Daily Volume

by benso87
24 stars

Daily Volume is an overlay indicator that displays current daily volume statistics inside an on-chart table in the top-right corner. It fetches higher-timeframe daily data to report real-time current daily volume, yesterday's total volume, and a simple moving

Indicator v5 VolumeScreeners & dashboards
Updated 4 years ago · MPL-2.0 GitHub repository of Daily Volume

Equity Intraday Analyst

by chris-c-thomas
14 stars

Equity Intraday Analyst is a comprehensive intraday overlay indicator for US equities and ETFs. It evaluates multi-EMA ribbons, session-anchored VWAP bands, OBV trends, momentum oscillators, TTM Squeeze, and optional market breadth indicators like NYSE TICK an

Indicator v6 TrendVolume
Updated 6 months ago · MIT GitHub repository of Equity Intraday Analyst

This daily-timeframe indicator provides futures market context by evaluating open interest and term structure without altering chart price scales. It requests front-month and next-month futures contracts to measure spread relationships like contango or backwar

Indicator v6 VolumeScreeners & dashboards
Updated yesterday · MIT GitHub repository of Futures Context Module [WavesUnchained]

Nexural QWAP

by JasonTeixeira
9 stars

Nexural QWAP calculates a volume-weighted average price combined with a cumulative volume delta order flow engine directly on the main price chart. It analyzes market structure by detecting volume absorption, liquidity sweeps, price-CVD divergence, stacked imb

Indicator v6 SMC / ICT / price actionVolume
Updated 12 days ago · Custom licence GitHub repository of Nexural QWAP

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