Changes the fill color of a box, or removes the fill when na is passed.
Only the interior changes; the outline keeps its color. A transparency from color.new(c, 85) tints the zone while price stays readable.
Recolor a zone when it is broken or retested, so the chart shows which zones are still live.
Syntax
box.set_bgcolor(id: series box, color: series color) -> void
box.set_bgcolor(color: series color) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | series box | required | The box whose fill color changes. |
| color | series color | required | New fill color. Use color.new(c, 85) for a see-through tint; na removes the fill and leaves the outline. |
Returns
Nothing.
Remarks
- On Sidechair: the fill is painted above the candles, so an opaque color hides them. na leaves only the outline and the text.
Example
//@version=6
indicator("box.set_bgcolor: tint", overlay = true)
var box z = box.new(bar_index, high, bar_index + 1, low)
box.set_right(z, bar_index)
box.set_bgcolor(z, close >= open ? color.new(color.green, 88) : color.new(color.red, 88))See also
Runs on Sidechair