Moves the left edge of a box to a new bar or timestamp and leaves the other three edges where they are.
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
box.set_left(id: series box, left: series int) -> void
box.set_left(left: series int) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | series box | required | The box whose left edge moves. |
| left | series int | required | New 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
//@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