Volume Heatmap

Volume Heatmap is an indicator drawn over the price chart.

tables and dashboardsstate

volume-heatmap.abx
1indicator "Volume Heatmap"
2pane: price
3
4input columns = 30
5input rows = 12
6
7state heat: list<Cell> = []
8
9top = highest(high, columns)
10bottom = lowest(low, columns)
11row_height = (top - bottom) / rows
12
13if bar.confirmed:
14for i in 0..rows:
15level = bottom + row_height * i
16heat.push(Cell(bar: bar.index, price: level, value: volume * (1 - abs(close - level) / (top - bottom))))
17heat = heat.keep_last(columns * rows)
18
19heatmap cells: heat, palette: "thermal"
What this script says

Volume Heatmap is an indicator drawn over the price chart.

You can change 2 inputs: columns (default 30) and rows (default 12).

It remembers heat from one bar to the next.

It calculates top as the highest high of the last columns bars, bottom as the lowest low of the last columns bars and row_height as (top minus bottom) divided by rows.

On each bar, it checks whether the bar has closed and, if so, goes through each i in 0 to rows and sets level to bottom plus row_height × i; it also adds Cell(bar: bar.index, price: level, value: volume * (1 - abs(close - level) / (top - bottom))) to heat; it also sets heat to heat.keep_last(columns * rows).

On the chart, it draws a heatmap.

Try this in the Terminal. AlgoBars is free: $0 a month, no card needed.

Create my free account