Moves the right edge of a box to a new bar or timestamp, so the zone ends earlier or later.
Calling box.set_right(z, bar_index) on every bar keeps a zone growing with the chart. The left edge stays where it was created.
A box that should reach the chart edge without being updated needs extend.right instead, which leaves the stored right edge unchanged. A right edge ahead of the last bar, such as bar_index + 20, projects the zone forward.
Syntax
box.set_right(id: series box, right: series int) -> void
box.set_right(right: series int) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | series box | required | The box whose right edge moves. |
| right | series int | required | New right edge: a bar index, or a timestamp in milliseconds for a box that uses xloc.bar_time. It may lie ahead of the last bar; na hides the box. |
Returns
Nothing.
Remarks
- On Sidechair: with
xloc.bar_timea timestamp after the last bar is placed ahead of it, one bar per timeframe step.
Example
//@version=6
indicator("box.set_right: grow until broken", overlay = true)
var box z = box.new(bar_index, high, bar_index + 1, low, bgcolor = color.new(color.orange, 88))
if close >= box.get_bottom(z)
box.set_right(z, bar_index)See also
Runs on Sidechair