Indicator · Pine Script v6 · Own pane

Trading Activity Index (Zeiierman)

by theonetrade· code credited to Zeiierman {

The Trading Activity Index calculates the logarithmic average of dollar volume over a formation window and compares it against rolling percentile bands over a history window.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code74
Settings2inputs
LicenceMIT
Last update2 weeks ago7 Nov 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

74 lines of Pine Script v6 from assets/trading-activity-index-zeiierman-dollar-volume-heatmap-with-percentile-bands.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

trading-activity-index-zeiierman-dollar-volume-heatmap-with-percentile-bands.pine
// This work is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International  
// https://creativecommons.org/licenses/by-nc-sa/4.0/

// © Zeiierman {
//@version=6
indicator("Trading Activity Index (Zeiierman)", overlay=false, max_bars_back=2000, precision = 1)
//~~}

// ~~ Tooltips {
t1 = "Formation window (bars) for averaging dollar volume before taking the log."
t2 = "History window (bars) used to compute rolling percentiles and bands."
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

// ~~ Inputs {
len_form   = input.int(20,  minval=2,  step=1, title="Formation Window (bars)", group="", inline="", tooltip=t1)
len_hist   = input.int(252, minval=50, step=5, title="History Window (bars)",   group="", inline="", tooltip=t2)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

// ~~ Core series {
var float na_f = na
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

// Dollar Volume: price * volume {
float dlrVol  = close * volume
float dlrVolAvg = ta.sma(dlrVol, len_form)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

// VOLSCALE proxy = log(average(dollar volume)) {
float vscale = math.log(math.max(dlrVolAvg, 1e-10))
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

// Rolling percentiles of VOLSCALE proxy over len_hist {
float p20 = ta.percentile_linear_interpolation(vscale, len_hist, 20)
float p40 = ta.percentile_linear_interpolation(vscale, len_hist, 40)
float p60 = ta.percentile_linear_interpolation(vscale, len_hist, 60)
float p80 = ta.percentile_linear_interpolation(vscale, len_hist, 80)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

// Percentile rank proxy for display only (normalize by rolling min/max) {
float vMin = ta.lowest(vscale, len_hist)
float vMax = ta.highest(vscale, len_hist)
float rank01 = (vMax == vMin) ? 0.5 : math.max(0.0, math.min(1.0, (vscale - vMin) / (vMax - vMin)))
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

// ~~ Gradient color function {
gradientColor(_val) =>
    // Light blue = rgb(173, 216, 230), Orange/Red = rgb(255, 69, 0)
    r1 = 173.0, g1 = 216.0, b1 = 230.0
    r2 = 255.0, g2 = 69.0,  b2 = 0.0
    r = r1 + (r2 - r1) * _val
    g = g1 + (g2 - g1) * _val
    b = b1 + (b2 - b1) * _val
    color.rgb(math.round(r), math.round(g), math.round(b))

blueGradient(_val) =>
    // Light blue → Deep blue for percentile bands
    r1 = 173.0, g1 = 216.0, b1 = 230.0  
    r2 = 0.0,   g2 = 0.0,   b2 = 255.0 
    r = r1 + (r2 - r1) * _val
    g = g1 + (g2 - g1) * _val
    b = b1 + (b2 - b1) * _val
    color.rgb(math.round(r), math.round(g), math.round(b))
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

// ~~ Plots {
plot(vscale, title="Trading Activity", color=gradientColor(rank01), linewidth=2)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

// Quintile bands {
plot(p20, title="P20", style=plot.style_line, linewidth=1, color=blueGradient(0.2))
plot(p40, title="P40", style=plot.style_line, linewidth=1, color=blueGradient(0.4))
plot(p60, title="P60", style=plot.style_line, linewidth=1, color=blueGradient(0.6))
plot(p80, title="P80", style=plot.style_line, linewidth=1, color=blueGradient(0.8))
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

Overview

Trading Activity Index (Zeiierman) plots the resulting activity line using a dynamic gradient based on relative normalized volume rank, along with four percentile threshold lines (20th, 40th, 60th, and 80th) in a separate pane. Key settings control the formation window length for dollar volume averaging and the historical lookback window for percentile calculation.

Details

Published by

theonetrade on GitHub

Code credit

Zeiierman {, as written in the script's header

Draws

Separate pane below the chart

Category

Volume

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.

Topics

algorithmic-tradingbacktestingccxtcryptofair-value-gapheikin-ashiohlcvorder-flowpine-scriptpinescriptpynecorepythonquantitative-financesupertrendtechnical-analysistrading-indicatorstradingviewtradingview-indicatorsvolume-profile

Settings

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

SettingTypeDefaultVariable
Formation Window (bars)int20len_form
History Window (bars)int252len_hist
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

Money Flow Index

by everget
947 stars

Calculates the standard Money Flow Index (MFI) oscillator alongside an exponential moving average signal line in a separate pane. The script visually highlights trend conditions through dynamic ribbon filling, optional difference histogram bars, and overbought

Indicator v4 Oscillators & momentumVolume
Updated 5 weeks ago · GPL-3.0 GitHub repository of Money Flow Index

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
550 stars

Range Volume Change compares volume inside a chosen session window with the same window on the previous day and plots that change as a percentage. It accumulates volume during the window and, when enabled, volume outside it, drawing growing columns in a separa

Indicator v5 VolumeSessions & time Repaints
Updated 11 months ago · None stated GitHub repository of Range Volume Change

[TVT] OBV with EMA

by namuan
321 stars

Calculates On-Balance Volume (OBV) alongside two Exponential Moving Averages (EMAs) applied directly to the cumulative OBV line. The indicator tracks volume flow relative to price movement and smooths it using short-term and longer-term EMAs to highlight volum

Indicator v6 VolumeOscillators & momentum
Updated 8 days ago · MIT GitHub repository of [TVT] OBV with EMA
257 stars

This indicator builds a footprint of estimated buy and sell volume across price rows and plots it in a separate pane. It fills rows from bar low to high, stores volume per row, and draws buy and sell volume boxes, volume-profile boxes, row labels, and cumulati

Indicator v5 Volume Repaints
Updated 2 months ago · None stated GitHub repository of Footprint Delta Lite

Commitment Gauge

by harryguiacorn
220 stars

This indicator measures directional momentum by evaluating candlestick body proportions and volume over a user-defined lookback window. It computes the ratio of candle body to total range, weights the cumulative value by volume and absolute body size, and dete

Indicator v4 VolumeCandlestick patterns
Updated 1 year ago · None stated GitHub repository of Commitment Gauge

More Volume scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers