Volume Heatmap
Volume Heatmap is an indicator drawn over the price chart.
tables and dashboardsstate
indicator "Volume Heatmap"pane: priceinput columns = 30input rows = 12state heat: list<Cell> = []top = highest(high, columns)bottom = lowest(low, columns)row_height = (top - bottom) / rowsif bar.confirmed:for i in 0..rows:level = bottom + row_height * iheat.push(Cell(bar: bar.index, price: level, value: volume * (1 - abs(close - level) / (top - bottom))))heat = heat.keep_last(columns * rows)heatmap cells: heat, palette: "thermal"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.