Sets the fill of a single cell, painting over the table's own background.
The cell fill takes priority over table.set_bgcolor(). Passing na removes the cell fill so the table background shows there again.
Heat-map tables come from calling it for each cell with a color computed from that cell's value.
Syntax
table.cell_set_bgcolor(table_id: series table, column: series int, row: series int, bgcolor: series color (optional)) -> void
table.cell_set_bgcolor(column: series int, row: series int, bgcolor: series color (optional)) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| table_id | series table | required | The table that holds the cell whose fill changes. |
| column | series int | required | Column of the cell whose fill changes, counting from 0 at the left. |
| row | series int | required | Row of the cell whose fill changes, counting from 0 at the top. |
| bgcolor | series color | na | New fill for this one cell. na removes it, so the table's own background shows again. |
Returns
Nothing.
Example
//@version=6
indicator("table.cell_set_bgcolor: RSI zones", overlay = true)
vals = array.from(ta.rsi(close, 7), ta.rsi(close, 14), ta.rsi(close, 28))
var t = table.new(position.top_right, 3, 1)
if barstate.islast
for i = 0 to 2
v = vals.get(i)
table.cell(t, i, 0, str.tostring(v, "#"))
table.cell_set_bgcolor(t, i, 0, v > 70 ? color.red : v < 30 ? color.green : color.gray)See also
Runs on Sidechair