Sidechair

box.get_top()

Browse the reference

Returns the price of the top edge of a box, exactly as it was last stored.

Try it in the editor

It reads the upper price that box.new() or box.set_top() stored. Compare it with high or close to detect a break above the zone.

A box built with its prices the other way round reports them as given: get_top() returns whatever was passed as top, even when it sits below the bottom.

Syntax

Pine Script
box.get_top(id: series box) -> series float
box.get_top() -> series float

Arguments

NameTypeDefaultDescription
idseries boxrequiredThe box to read the top price from. na gives na back.

Returns

series float: Price of the top edge, as it was last set.

Remarks

  • On Sidechair: with na or another drawing type as id, the result is na.

Example

Pine ScriptBreak above the zoneOpen in editor
//@version=6
indicator("box.get_top: breakout", overlay = true)
var box z = box.new(bar_index, high, bar_index + 1, low)
box.set_right(z, bar_index)
plotshape(close > box.get_top(z), "Breakout", shape.triangleup, location.belowbar, color.green)

See also

Runs on Sidechair