Indicator · Pine Script v5 · Own pane

Heatmap Volume [xdecow]

by theonetrade

Heatmap Volume [xdecow] evaluates trading volume relative to its moving average and standard deviation, plotting in a separate pane.

View on GitHub

GitHub stars34on the repository
Pine versionv5runs as is
Lines of code179
Settings24inputs
LicenceMIT
Last update2 weeks ago8 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

179 lines of Pine Script v5 from assets/indicator/bit-exact/heatmap_volume_xdecow_unWex8N4.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

heatmap_volume_xdecow_unWex8N4.pine
//@version=5

indicator(title='Heatmap Volume [xdecow]', shorttitle='HMV [xdecow]', format=format.volume)

//------------------------------------------------------------------------------
// Inputs


length = input.int(610, title='MA Length', minval = 2, tooltip = 'Moving Average Length\n\n- Smaller values will respond more quickly and activate more frequently. (Best for short-term analysis)\n- Larger values will have a slower response, will be less sensitive to small volume variations, and will highlight large volumes. (Best for long-term analysis)\n\nFormula: How many stdev is the volume far from the Moving Average?')
slength = input.int(610, title='Standard Deviation Length', minval=2, tooltip = 'Standard Deviation lookback period.\n\nFormula: How many stdev is the volume far from the Moving Average?')


g_hmz = 'Heatmap Threshold Multipliers'
thresholdExtraHigh = input.float(4, title='Extra High Multiplier', tooltip = 'Volume Threshold Multiplier\neg: 4 = 400% or 4 x Stdev above the mean', group=g_hmz)
thresholdHigh = input(2.5, title='High Multiplier', group=g_hmz)
thresholdMedium = input.float(1, title='Medium Multiplier', group=g_hmz)
thresholdNormal = input(-0.5, title='Normal Multiplier', group=g_hmz)



//------------------------------------------------------------------------------
// Colors


// config
g_color = 'Color settings'
bcolor_enabled = input(true, 'Colored bars', group = g_color)
zmode = input.string('Backgrounds', 'Display Heatmap Zones as', options=['None', 'Lines', 'Backgrounds', 'Both'], group = g_color)
cmode = input.string('Heatmap', 'Color Mode', options=['Heatmap', 'Up/Down'], group = g_color, tooltip = '- Heatmap mode: colors based only on volume.\n- Up/Down mode: colors based on candle volume and direction.\nChange the cores below according to the selected mode.')


// heatmap colors
chm1 = #ff0000  // extra high red
chm2 = #ff7800  // high orange
chm3 = #ffcf03  // medium yellow
chm4 = #a0d6dc  // normal
chm5 = #1f9cac  // low

// heatmap colors
g_mhcolor = 'Heatmap colors'
chmthresholdExtraHigh = input(chm1, 'Extra High', group=g_mhcolor)
chmthresholdHigh = input(chm2, 'High', group=g_mhcolor)
chmthresholdMedium = input(chm3, 'Medium', group=g_mhcolor)
chmthresholdNormal = input(chm4, 'Normal', group=g_mhcolor)
chmthresholdLow = input(chm5, 'Low', group=g_mhcolor)





// up colors
g_up = 'Up colors'
cupthresholdExtraHigh = input(#00FF00, 'Extra High', group = g_up)
cupthresholdHigh = input(#30FF30, 'High', group = g_up)
cupthresholdMedium = input(#60FF60, 'Medium', group = g_up)
cupthresholdNormal = input(#8FFF8F, 'Normal', group = g_up)
cupthresholdLow = input(#BFFFBF, 'Low', group = g_up)


// down colors
g_down = 'Down colors'
cdnthresholdExtraHigh = input(#FF0000, 'Extra High', group = g_down)
cdnthresholdHigh = input(#FF3030, 'High', group = g_down)
cdnthresholdMedium = input(#FF6060, 'Medium', group = g_down)
cdnthresholdNormal = input(#FF8F8F, 'Normal', group = g_down)
cdnthresholdLow = input(#FFBFBF, 'Low', group = g_down)


// threshold colors
cthresholdExtraHighUp = cmode == 'Heatmap' ? chmthresholdExtraHigh : cupthresholdExtraHigh
cthresholdHighUp = cmode == 'Heatmap' ? chmthresholdHigh : cupthresholdHigh
cthresholdMediumUp = cmode == 'Heatmap' ? chmthresholdMedium : cupthresholdMedium
cthresholdNormalUp = cmode == 'Heatmap' ? chmthresholdNormal : cupthresholdNormal
cthresholdLowUp = cmode == 'Heatmap' ? chmthresholdLow : cupthresholdLow

cthresholdExtraHighDn = cmode == 'Heatmap' ? chmthresholdExtraHigh : cdnthresholdExtraHigh
cthresholdHighDn = cmode == 'Heatmap' ? chmthresholdHigh : cdnthresholdHigh
cthresholdMediumDn = cmode == 'Heatmap' ? chmthresholdMedium : cdnthresholdMedium
cthresholdNormalDn = cmode == 'Heatmap' ? chmthresholdNormal : cdnthresholdNormal
cthresholdLowDn = cmode == 'Heatmap' ? chmthresholdLow : cdnthresholdLow



//------------------------------------------------------------------------------
// Calcs


length := length > bar_index + 1 ? bar_index + 1 : length
slength := slength > bar_index + 1 ? bar_index + 1 : slength

dir = close > open
mean = ta.sma(volume, length)
std = ta.stdev(volume, slength)

// how many stdev is the volume far from the mean?
// eg: stdbar = 2.5, is 2.5 * stdev above the mean (2.5 * stdev + mean)
stdbar = (volume - mean) / std 

bcolor = stdbar > thresholdExtraHigh ? dir ? cthresholdExtraHighUp : cthresholdExtraHighDn : stdbar > thresholdHigh ? dir ? cthresholdHighUp : cthresholdHighDn : stdbar > thresholdMedium ? dir ? cthresholdMediumUp : cthresholdMediumDn : stdbar > thresholdNormal ? dir ? cthresholdNormalUp : cthresholdNormalDn : dir ? cthresholdLowUp : cthresholdLowDn

// heatmap lines
zshow_lines = zmode == 'Lines' or zmode == 'Both'
zshow_backgrounds = zmode == 'Backgrounds' or zmode == 'Both'

ts1 = std * thresholdExtraHigh + mean
ts2 = std * thresholdHigh + mean
ts3 = std * thresholdMedium + mean
ts4 = std * thresholdNormal + mean
ts0 = 0

tsDelta = ts1 - ts2
tst = ts1 + tsDelta




//------------------------------------------------------------------------------
// Plots


barcolor(bcolor_enabled ? bcolor : na, editable=false)


// hidden heatmap lines to fill
pt = plot(zshow_backgrounds ? tst : na, color=na, display=display.none, editable=false)
p0 = plot(zshow_backgrounds ? ts0 : na, color=na, display=display.none, editable=false)
p1 = plot(zshow_backgrounds ? ts1 : na, color=na, display=display.none, editable=false)
p2 = plot(zshow_backgrounds ? ts2 : na, color=na, display=display.none, editable=false)
p3 = plot(zshow_backgrounds ? ts3 : na, color=na, display=display.none, editable=false)
p4 = plot(zshow_backgrounds ? ts4 : na, color=na, display=display.none, editable=false)


// heatmap fills
tpf = 85
fill(pt, p1, color.new(chm1, tpf), title='Extra High heatmap zone')
fill(p1, p2, color.new(chm2, tpf), title='High heatmap zone')
fill(p2, p3, color.new(chm3, tpf), title='Medium heatmap zone')
fill(p3, p4, color.new(chm4, tpf), title='Normal heatmap zone')
fill(p4, p0, color.new(chm5,tpf), title='Low heatmap zone')


// volume
plot(volume, color=bcolor, style=plot.style_columns, title='Volume', editable=false)


// moving average
plot(mean, color=color.new(#000000, 0), linewidth=2, title='Moving Average', style=plot.style_line, display=display.none)


// heatmap lines
tpp = 50
plot(zshow_lines ? ts1 : na, color=color.new(chm1, tpp), title='Extra High heatmap line')
plot(zshow_lines ? ts2 : na, color=color.new(chm2, tpp), title='High heatmap line')
plot(zshow_lines ? ts3 : na, color=color.new(chm3, tpp), title='Medium heatmap line')
plot(zshow_lines ? ts4 : na, color=color.new(chm4, tpp), title='Normal heatmap line')



//------------------------------------------------------------------------------
// Alerts


conditionExtraHigh = stdbar > thresholdExtraHigh
conditionHigh = stdbar <= thresholdExtraHigh and stdbar > thresholdHigh
conditionMedium = stdbar <= thresholdHigh and stdbar > thresholdMedium
conditionNormal = stdbar <= thresholdMedium and stdbar > thresholdNormal
conditionLow = stdbar <= thresholdNormal

alertcondition(conditionExtraHigh, title='Any Extra High Vol', message='Any Bar Extra High Volume Threshold')
alertcondition(conditionExtraHigh and open < close, title='Up Extra High', message='Up Bar Extra High Volume Threshold')
alertcondition(conditionExtraHigh and open > close, title='Down Extra High', message='Down Bar Extra High Volume Threshold')

alertcondition(conditionHigh, title='Any High Vol', message='Any Bar High Volume Threshold')
alertcondition(conditionHigh and open < close, title='Up High Vol', message='Up Bar High Volume Threshold')
alertcondition(conditionHigh and open > close, title='Down High Vol', message='Down Bar High Volume Threshold')

alertcondition(conditionMedium, title='Any Medium Vol', message='Any Bar Medium Volume Threshold')
alertcondition(conditionMedium and open < close, title='Up Medium Vol', message='Up Bar Medium Volume Threshold')
alertcondition(conditionMedium and open > close, title='Down Medium Vol', message='Down Bar Medium Volume Threshold')

Overview

Heatmap Volume [xdecow] classifies volume into five distinct intensity tiers—Extra High, High, Medium, Normal, and Low—based on configurable standard deviation multipliers. Users can choose between a pure heatmap coloring mode or a directional up/down mode that also accounts for candle direction. Additionally, the indicator can highlight threshold zones using lines, background fills, or both. It serves purely as an analytical visualization tool without automated trade signals.

Details

Published by

theonetrade on GitHub

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-tradingbacktestingbitcoinccxtcrypto-tradingllm-agentoffline-backtestingopen-source-tradingpine-scriptpine-to-pythonpinescriptpynecorepythonquantquantitative-financestrategy-backtestingtechnical-analysistrading-indicatorstrading-strategiestradingview

Settings

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

SettingTypeDefaultVariable
MA Lengthint610length
Standard Deviation Lengthint610slength
Extra High Multiplierfloat4thresholdExtraHigh
High Multiplierfloat2.5thresholdHigh
Medium Multiplierfloat1thresholdMedium
Normal Multiplierfloat-0.5thresholdNormal
Colored barsbooltruebcolor_enabled
Display Heatmap Zones asstringBackgroundszmode
Color ModestringHeatmapcmode
Extra Highinputchm1chmthresholdExtraHigh
Highinputchm2chmthresholdHigh
Mediuminputchm3chmthresholdMedium
Show all 24 settings
SettingTypeDefaultVariable
Normalinputchm4chmthresholdNormal
Lowinputchm5chmthresholdLow
Extra Highcolor#00FF00cupthresholdExtraHigh
Highcolor#30FF30cupthresholdHigh
Mediumcolor#60FF60cupthresholdMedium
Normalcolor#8FFF8FcupthresholdNormal
Lowcolor#BFFFBFcupthresholdLow
Extra Highcolor#FF0000cdnthresholdExtraHigh
Highcolor#FF3030cdnthresholdHigh
Mediumcolor#FF6060cdnthresholdMedium
Normalcolor#FF8F8FcdnthresholdNormal
Lowcolor#FFBFBFcdnthresholdLow
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