Moves the top-left corner of a box in one call, changing the left edge and the top edge together.
Both values are written before the next bar is drawn, so the corner never shows a half-moved state. The right and bottom edges are untouched.
Use it when a corner is anchored to an event such as a pivot, and box.set_rightbottom() for the opposite corner.
Syntax
box.set_lefttop(id: series box, left: series int, top: series int/float) -> void
box.set_lefttop(left: series int, top: series int/float) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | series box | required | The box whose top-left corner 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. |
| top | series int/ | required | New price of the top edge, set together with the left edge. na hides the box until a real price is set. |
Returns
Nothing.
Remarks
- On Sidechair: an na in either value hides the box until both are real numbers again.
Example
//@version=6
indicator("box.set_lefttop: follow the pivot", overlay = true)
ph = ta.pivothigh(high, 5, 5)
var box z = box.new(bar_index, high, bar_index + 1, low, bgcolor = color.new(color.green, 88))
if not na(ph)
box.set_lefttop(z, bar_index - 5, ph)
box.set_right(z, bar_index)
box.set_bottom(z, ta.lowest(low, 30))See also
Runs on Sidechair