Returns the price stored for the first end point of a line.
It reads back what line.new(), line.set_y1() or line.set_xy1() last stored, in price units. Use it to compare the start of a drawn level with the current price without keeping a separate variable.
line.get_price() at the first x gives the same number unless the line is vertical. With a na id the result is na.
Syntax
line.get_y1(id: series line) -> series float
line.get_y1() -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | series line | required | The line to read the first point's price from. |
Returns
series float: The y coordinate of the first point.
Example
//@version=6
indicator("line.get_y1: percent from anchor", overlay = false)
var line ln = na
if timeframe.change("D")
ln := line.new(bar_index, open, bar_index + 1, open, extend = extend.right)
plot(na(ln) ? na : (close / line.get_y1(ln) - 1) * 100, "Percent from open")See also
Runs on Sidechair