Moves the top edge of a box to a new price, so the box grows taller or shorter from above.
The bottom edge and both sides stay put. Raising the top makes the box taller; lowering it cuts the box down from above.
Read box.get_top() first when the ceiling should only ever rise, as in math.max(box.get_top(z), high).
Syntax
box.set_top(id: series box, top: series int/float) -> void
box.set_top(top: series int/float) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | series box | required | The box whose top edge moves. |
| top | series int/ | required | New price of the top edge, in the chart's price units. na hides the box until a real price is set. |
Returns
Nothing.
Remarks
- On Sidechair: a top set below the bottom keeps both numbers as given and draws the same rectangle, and
box.get_top()returns the number you passed.
Example
//@version=6
indicator("box.set_top: ceiling that ratchets", overlay = true)
var box z = box.new(bar_index, high, bar_index + 1, low, bgcolor = color.new(color.red, 88))
box.set_right(z, bar_index)
box.set_top(z, math.max(box.get_top(z), high))See also
Runs on Sidechair