Sidechair

box.set_left()

Browse the reference

Moves the left edge of a box to a new bar or timestamp and leaves the other three edges where they are.

Try it in the editor

The new x is read in the box's own unit: a bar index for the default xloc, a timestamp in milliseconds for xloc.bar_time. Moving only this edge widens or narrows the box from its start.

To move the left edge and the top together in one call, box.set_lefttop() takes both.

Syntax

Pine Script
box.set_left(id: series box, left: series int) -> void
box.set_left(left: series int) -> void

Arguments

NameTypeDefaultDescription
idseries boxrequiredThe box whose left edge moves.
leftseries intrequiredNew left edge: a bar index, or a timestamp in milliseconds for a box that uses xloc.bar_time. na hides the box until a real value is set.

Returns

Nothing.

Remarks

  • On Sidechair: a left edge placed after the right edge still draws a rectangle between the two, and na is stored as given, so the box is not drawn until a real value replaces it.

Example

Pine ScriptAnchor a growing box further backOpen in editor
//@version=6
indicator("box.set_left: reach back", overlay = true)
var box z = box.new(bar_index, high, bar_index + 1, low, bgcolor = color.new(color.purple, 88))
box.set_left(z, math.max(0, bar_index - 30))
box.set_right(z, bar_index)

See also

Runs on Sidechair