Returns the right edge of a box: a bar index, or a timestamp in milliseconds for a box placed with xloc.bar_time.
A box stretched with extend.right still reports the right edge that was stored, not the chart's edge.
Use it to tell whether price has moved past the end of a zone, or to stretch the box one bar further each bar with box.set_right(z, box.get_right(z) + 1).
Syntax
box.get_right(id: series box) -> series int
box.get_right() -> series intArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | series box | required | The box to read the right edge from. na gives na back. |
Returns
series int: Bar index of the right edge, or a millisecond timestamp for a box that uses xloc.bar_time.
Remarks
- On Sidechair: a right edge ahead of the last bar is returned as stored, and an na or non-box argument returns na.
Example
//@version=6
indicator("box.get_right: grow", overlay = true)
var box z = box.new(bar_index, high, bar_index + 1, low, bgcolor = color.new(color.green, 85))
box.set_right(z, box.get_right(z) + 1)See also
Runs on Sidechair