Sidechair

box.set_border_color()

Browse the reference

Changes the color of a box's outline, or removes the outline when na is passed.

Try it in the editor

Only the outline is recolored; the fill keeps its color. A stronger border on a pale fill marks the limits of a zone, while matching colors read as one solid block.

Switching the outline by condition turns a zone into a status light, for example green after a break upward and red after a break downward.

Syntax

Pine Script
box.set_border_color(id: series box, color: series color) -> void
box.set_border_color(color: series color) -> void

Arguments

NameTypeDefaultDescription
idseries boxrequiredThe box whose outline color changes.
colorseries colorrequiredNew outline color. na removes the outline; a border width of 0 hides it as well, whatever color is set.

Returns

Nothing.

Remarks

  • A width of 0 hides the outline whatever color is set, so check box.set_border_width() when a recolor seems to do nothing.

Example

Pine ScriptBorder shows which side brokeOpen in editor
//@version=6
indicator("box.set_border_color: break side", overlay = true)
var box z = box.new(bar_index, high, bar_index + 1, low, bgcolor = color.new(color.gray, 90))
box.set_right(z, bar_index)
box.set_border_color(z, close > box.get_top(z) ? color.green : close < box.get_bottom(z) ? color.red : color.gray)

See also

Runs on Sidechair