Nicolas

Volume Heatmap & Bubbles: order flow heatmap, delta bubbles and volume profile

Studio Only
Category: Indicators By: Nicolas Created: December 2, 2026, 5:30 PM
December 2, 2026, 5:30 PM
Indicators
0 Comments
ProRealCode Script
Volume Heatmap & Bubbles: order flow heatmap, delta bubbles and volume profile

Volume Heatmap & Bubbles brings an order flow style view to ProRealTime charts. Behind the candles, a heatmap shows where the volume traded and how long each price level stays “hot”. On top, bubbles mark the heavy candles in green or red, depending on whether buyers or sellers dominated. On the right, a buy/sell volume profile sits next to the live best bid and best ask. A table gives the cumulative delta, the busiest price and the balance of the order book at the touch.

This code is written in ProRealCode Script and runs with ProRealCode Studio on ProRealTime Web.

Volume heatmap indicator on a 1-minute Mini DAX chart with order flow bubbles, volume profile and cumulative delta

What a volume heatmap shows

Order flow heatmaps are popular with futures scalpers because they show at a glance which prices matter. The bright horizontal streaks are the levels where a lot of volume changed hands. They often act as support and resistance later, because many positions were opened there. The dark areas are the prices the market went through quickly and may cross again just as fast.

A full order book heatmap needs every level of market depth, tick by tick. A ProBuilder indicator does not get that. It gets the candles and, in ProRealCode Script, the live best bid and best ask. This indicator therefore builds its heatmap from the traded volume of each candle. That is the part of the order flow that actually happened, not the orders that could still be cancelled.

1. The heatmap of traded volume

The indicator takes the last 150 bars (adjustable) and cuts their price range into 40 rows. Each candle spreads its volume evenly over the rows its range covers. Every row keeps a memory that fades a little at each new bar: with the default 0.94, a level loses 6% of its heat per bar. A level that keeps trading stays bright, while a level that the market leaves fades back into the dark blue. That is what draws the streaks across the chart.

  • Colours: navy for a faint level, then blue, cyan, yellow, and orange to red for the busiest. The scale is relative to the hottest cell of the window, with a curve that brings out the medium levels.
  • Memory: 0.80 shows only the very recent activity, 0.99 keeps levels alive for hundreds of bars. At 1 nothing fades, and the heatmap becomes a cumulative volume at price map: each row gets brighter from left to right as volume builds up (second capture below).
  • Colour steps: 12 by default. More steps give a smoother gradient. Neighbouring cells of the same colour are merged into one rectangle, so the chart draws a few hundred shapes instead of thousands.
  • Without volume: on a cash index or a CFD with no volume, every candle counts as one unit of time. The heatmap then shows the time spent at each price, like a market profile.

2. The volume bubbles and the delta

Each candle’s volume is split into an estimated buy part and sell part from where it closed in its range: a close on the high counts as all buying, a close on the low as all selling, a close in the middle as half and half. The difference is the candle’s delta.

  • A bubble is drawn on every candle whose volume is above 1.8 times its 50-bar average. It is green when the delta is positive and red when it is negative, and it grows with the volume (five sizes).
  • Bubbles cluster where the big players were active: at the start of a move, on a breakout, or on a climax at the end of a trend. A large red bubble on a high, followed by a fading heatmap above, often marks absorption by sellers.
  • The cumulative delta adds up the delta of every candle. It is shown as a sparkline in the table. When price makes a new high and the cumulative delta does not, buyers are getting weaker: a classic delta divergence.

The buy/sell split is an estimate from the candle, not a count of trades at the bid and at the ask. It reads the pressure of each candle well, but it is not a true footprint.

3. The volume profile

To the right of the last bar, a volume profile adds up the whole window row by row, with the buy part in green and the sell part in red. The busiest row is the point of control, extended as a dotted yellow line across the heatmap. The high volume nodes of the profile line up with the bright streaks of the heatmap. The low volume nodes, the short rows, are the gaps that price tends to cross quickly.

4. The live best bid and best ask

On a future or a stock, the indicator reads the live order book at the touch with BID, ASK, BIDSIZE and ASKSIZE. The best bid and best ask are drawn as two short lines after the last candle, with a label giving their price and the size waiting there. The table shows the size imbalance on a gauge, from −100% (only sellers at the touch) to +100% (only buyers). These values refresh about four times a second. They are not stored in the history, because the platform publishes no past order book, so they only appear on the last bar. On an instrument with no book, the table shows “no book”.

The table

  • Cumulative delta: a sparkline of the last 60 bars.
  • Last candle delta: the estimated buy minus sell volume of the current candle.
  • Busiest price: the point of control of the window.
  • Heavy candles: how many candles of the window got a bubble.
  • Book at the touch: the bid/ask size imbalance, when the instrument has a book.

Settings and how to use it

Paste the code into a new Studio tab and run it on an intraday chart of an instrument with volume: index futures such as the Mini DAX or the Nasdaq, or stocks. It works from 15 seconds to 15 minutes. Leave some space on the right of the chart for the profile. Every setting is a field of the Variables form:

  • Heatmap: bars and rows: the window and its resolution. 150 bars and 40 rows are light. 1000 bars and 50 rows give the long view of the third capture.
  • Heatmap: memory per bar: how long a level stays hot, from 0.80 to 0.99, or 1 for a cumulative map.
  • Heatmap: colour steps: 12 by default, up to 100 for a smooth gradient.
  • Bubbles: the volume threshold, in multiples of the 50-bar average. Raise it to keep only the biggest candles.
  • Profile: its width and its distance from the last bar.

A typical reading: price comes back to a bright streak of the heatmap that lines up with a high volume node of the profile, a large bubble appears there against the move, and the cumulative delta turns. Each of these is a reason. None of them is a signal on its own.

Volume heatmap with full memory on a 15-second Mini DAX chart, cumulative volume at price, with the settings form

Memory set to 1 on 15-second candles: nothing fades, each row gets brighter as volume builds up, and the heatmap becomes a cumulative volume at price map that matches the profile on the right.

Volume heatmap over 1000 bars on a 15-second Mini DAX chart, with high volume nodes, delta bubbles and the live bid and ask

1000 bars, 50 rows, memory 0.99 and 100 colour steps on 15-second candles: the high volume nodes of the session stand out as long streaks, with the live bid and ask at the right edge.

Under the hood

The code also shows several additions of ProRealCode Script: input() fields, a FUNCTION returning three values (the r, g, b of the heat ramp), arrays holding the whole grid of the heatmap, two passes over it with run-length merging of the rectangles, DRAWPOINT for the bubbles, drawings beyond the last bar, the live BID, ASK, BIDSIZE and ASKSIZE, and a table with DRAWTABLE, TABLECELL, TABLESPARK and TABLEGAUGE.

// ============================================================================
// Volume Heatmap & Bubbles
// An order-flow style view built from the chart's own candles
// ----------------------------------------------------------------------------
// Author: Nicolas — ProRealCode
// Runs with ProRealCode Studio: https://www.prorealcode.com/prorealcode-studio/
// ----------------------------------------------------------------------------
// Behind the candles, a heatmap of where the volume traded: each candle spreads
// its volume over the prices it covered, and every price level keeps a memory
// that fades bar after bar, so busy levels leave bright streaks across the
// chart. On top: bubbles for the heavy candles (green when buyers dominated,
// red when sellers did), a buy/sell volume profile on the right, the live best
// bid and ask with their sizes, and a table with the cumulative delta.
// Buy and sell volume are estimated from where each candle closed in its
// range: the platform gives the candles, not the individual trades.
// ============================================================================

input(lookback, 150, "Heatmap: bars", int)
input(rows, 40, "Heatmap: rows", int)
input(memory, 0.94, "Heatmap: memory per bar (0.80 short, 0.99 long)", float)
input(steps, 12, "Heatmap: colour steps", int)
input(bubbleMin, 1.8, "Bubbles: volume above x times the average", float)
input(profWidth, 25, "Profile: width (bars)", int)
input(profGap, 4, "Profile: space after the last bar", int)

// The heat ramp: navy for a faint level, then blue, cyan, yellow, and red for
// the busiest. A function can return several values: here r, g, b.
FUNCTION heat(t)
IF t < 0.25 THEN
u = t / 0.25
RETURN 20 + 10 * u, 40 + 60 * u, 110 + 110 * u
ELSIF t < 0.5 THEN
u = (t - 0.25) / 0.25
RETURN 30 + 10 * u, 100 + 120 * u, 220 + 10 * u
ELSIF t < 0.75 THEN
u = (t - 0.5) / 0.25
RETURN 40 + 210 * u, 220 + 10 * u, 230 - 170 * u
ENDIF
u = (t - 0.75) / 0.25
RETURN 250, 230 - 170 * u, 60 - 20 * u
ENDFUNCTION

// ── 1. Buy and sell volume of each candle, and the cumulative delta ─────────
// Without volume (a cash index), every candle weighs 1: the heatmap then shows
// the time spent at each price.
IF volume > 0 THEN
vol = volume
ELSE
vol = 1
ENDIF
IF high > low THEN
buyV = vol * (close - low) / (high - low)
ELSE
buyV = vol / 2
ENDIF
sellV = vol - buyV
delta = buyV - sellV
once cvd = 0
cvd = cvd + delta
avgV = Average[50](vol)

IF islastbarupdate THEN
n = MIN(lookback, barindex + 1)
x0 = barindex - n + 1

// ── 2. The price grid of the window ────────────────────────────────────────
hi = high
lo = low
FOR k = 0 TO n - 1 DO
hi = MAX(hi, high[k])
lo = MIN(lo, low[k])
NEXT
step = (hi - lo) / rows
IF step <= 0 THEN
step = ticksize
ENDIF

// ── 3. First pass: the fading memory of every price level, bar by bar ─────
// $g holds the whole grid, one row after the other for each bar.
FOR b = 0 TO rows - 1 DO
$h[b] = 0
$pb[b] = 0
$ps[b] = 0
NEXT
top = 0
FOR k = n - 1 DOWNTO 0 DO
b0 = MAX(0, MIN(rows - 1, FLOOR((low[k] - lo) / step)))
b1 = MAX(0, MIN(rows - 1, FLOOR((high[k] - lo) / step)))
share = vol[k] / (b1 - b0 + 1)
bshare = buyV[k] / (b1 - b0 + 1)
c = n - 1 - k
FOR b = 0 TO rows - 1 DO
v = $h[b] * memory
IF b >= b0 AND b <= b1 THEN
v = v + share
$pb[b] = $pb[b] + bshare
$ps[b] = $ps[b] + share - bshare
ENDIF
$h[b] = v
$g[c * rows + b] = v
top = MAX(top, v)
NEXT
NEXT

// ── 4. Second pass: paint the grid, one rectangle per run of equal colour ──
// Merging neighbours of the same colour keeps a few hundred rectangles
// instead of thousands.
FOR b = 0 TO rows - 1 DO
$runFrom[b] = x0
$runLvl[b] = 0
NEXT
IF top > 0 THEN
FOR c = 0 TO n DO
FOR b = 0 TO rows - 1 DO
IF c < n THEN
lvl = FLOOR(POW($g[c * rows + b] / top, 0.6) * steps)
ELSE
lvl = -1
ENDIF
IF lvl <> $runLvl[b] THEN
IF $runLvl[b] > 0 THEN
t = MIN(1, $runLvl[b] / steps)
(cr, cg, cb) = heat(t)
DRAWRECTANGLE($runFrom[b] - 0.5, lo + b * step, x0 + c - 0.5, lo + (b + 1) * step) FILLCOLOR(cr, cg, cb, 60 + 130 * t) COLOURED(cr, cg, cb, 0)
ENDIF
$runFrom[b] = x0 + c
$runLvl[b] = lvl
ENDIF
NEXT
NEXT
ENDIF

// ── 5. Bubbles on the heavy candles, sized by their volume ────────────────
bubbles = 0
IF volume > 0 OR avgV > 1 THEN
FOR k = 0 TO n - 1 DO
IF avgV[k] > 0 AND vol[k] > bubbleMin * avgV[k] THEN
sz = MIN(5, 1 + FLOOR((vol[k] / avgV[k] - bubbleMin) * 2))
bubbles = bubbles + 1
IF delta[k] >= 0 THEN
DRAWPOINT(barindex - k, close[k], sz) COLOURED(60, 220, 130, 210) BORDERCOLOR(210, 255, 225, 240)
ELSE
DRAWPOINT(barindex - k, close[k], sz) COLOURED(240, 80, 90, 210) BORDERCOLOR(255, 215, 215, 240)
ENDIF
ENDIF
NEXT
ENDIF

// ── 6. The volume profile of the window: buyers in green, sellers in red ───
pMax = 0
poc = 0
FOR b = 0 TO rows - 1 DO
IF $pb[b] + $ps[b] > pMax THEN
pMax = $pb[b] + $ps[b]
poc = b
ENDIF
NEXT
xp = barindex + profGap
IF pMax > 0 THEN
FOR b = 0 TO rows - 1 DO
lb = $pb[b] / pMax * profWidth
ls = $ps[b] / pMax * profWidth
IF lb + ls > 0 THEN
DRAWRECTANGLE(xp, lo + b * step, xp + lb, lo + (b + 1) * step) FILLCOLOR(60, 200, 120, 170) COLOURED(60, 200, 120, 0)
DRAWRECTANGLE(xp + lb, lo + b * step, xp + lb + ls, lo + (b + 1) * step) FILLCOLOR(230, 80, 90, 170) COLOURED(230, 80, 90, 0)
ENDIF
NEXT
pocPrice = lo + (poc + 0.5) * step
DRAWSEGMENT(x0, pocPrice, xp + profWidth, pocPrice) COLOURED(250, 230, 60, 200) STYLE(dottedline, 1)
ENDIF

// ── 7. The live best bid and best ask, with the size waiting at each ───────
hasBook = ISSET(bid) AND ISSET(ask)
IF hasBook THEN
DRAWSEGMENT(barindex, ask, xp - 1, ask) COLOURED(240, 80, 90) STYLE(line, 2)
DRAWSEGMENT(barindex, bid, xp - 1, bid) COLOURED(60, 220, 130) STYLE(line, 2)
DRAWLABEL(xp + profWidth + 1, ask, "Ask #ask# · #asksize#", none, small, left) COLOURED(255, 255, 255) FILLCOLOR(175, 55, 65)
DRAWLABEL(xp + profWidth + 1, bid, "Bid #bid# · #bidsize#", none, small, left) COLOURED(255, 255, 255) FILLCOLOR(40, 150, 95)
ENDIF

// ── 8. The table ───────────────────────────────────────────────────────────
board = DRAWTABLE(6, 2, topleft) FILLCOLOR(12, 18, 36, 235) BORDERCOLOR(40, 70, 140)
TABLEMERGE(board, 0, 0, 1, 2)
TABLECELL(board, 0, 0, "Volume heatmap", bold, center, 14) COLOURED(214, 228, 255)
TABLECELL(board, 1, 0, "Cumulative delta") COLOURED(150, 170, 210)
TABLESPARK(board, 1, 1, cvd, 60) COLOURED(80, 200, 230)
dTxt = ROUND(delta)
TABLECELL(board, 2, 0, "Last candle delta") COLOURED(150, 170, 210)
IF delta >= 0 THEN
TABLECELL(board, 2, 1, "+#dTxt#", bold, right) COLOURED(60, 220, 130)
ELSE
TABLECELL(board, 2, 1, "#dTxt#", bold, right) COLOURED(240, 80, 90)
ENDIF
pocTxt = ROUND(pocPrice / ticksize) * ticksize
TABLECELL(board, 3, 0, "Busiest price") COLOURED(150, 170, 210)
TABLECELL(board, 3, 1, "#pocTxt#", right) COLOURED(250, 230, 60)
TABLECELL(board, 4, 0, "Heavy candles") COLOURED(150, 170, 210)
TABLECELL(board, 4, 1, "#bubbles# of #n#", right) COLOURED(214, 228, 255)
TABLECELL(board, 5, 0, "Book at the touch") COLOURED(150, 170, 210)
IF hasBook AND bidsize + asksize > 0 THEN
imb = ROUND((bidsize - asksize) / (bidsize + asksize) * 100)
TABLEGAUGE(board, 5, 1, imb, 0 - 100, 100, "#imb#%") GRADIENTCOLOR(imb, 0 - 60, 60, "#f0505a", "#8fa4c0", "#3cdc82")
ELSE
TABLECELL(board, 5, 1, "no book", right) COLOURED(150, 170, 210)
ENDIF
ENDIF

RETURN
No ITF file for this code
A Studio Only code is not imported into ProRealTime™. Copy it and paste it into the ProRealCode Studio editor.
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

ProRealCode ProRealCode
Loading...