Moves only the ending price of a line, up or down.
The left end stays, so the line tilts around its first point. Feeding it a series such as close each bar keeps the right end on that series.
A horizontal line turns sloped the moment the two prices differ, and a ray keeps the new slope past the second point.
Syntax
line.set_y2(id: series line, y: series int/float) -> void
line.set_y2(y: series int/float) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | series line | required | The line whose second price changes; the first point does not move. |
| y | series int/ | required | New price for the second point, in chart price units. Pass a series such as close to make the right end follow it. |
Returns
Nothing.
Example
//@version=6
indicator("line.set_y2: ATR slope", overlay = true)
a = ta.atr(10)
var line ray = na
if timeframe.change("D")
ray := line.new(bar_index, open, bar_index + 10, open, extend = extend.right, color = color.teal)
line.set_y2(ray, line.get_y1(ray) + a)See also
Runs on Sidechair