Sidechair

line.set_extend()

Browse the reference

Chooses how far a line runs past its points: not at all, left, right or both.

Try it in the editor

extend.none shows only the segment. extend.right continues past the second point, extend.left before the first, and extend.both fills the pane from edge to edge along the slope.

A level that should stay visible as bars arrive needs an extension, and one that has been replaced can go back to extend.none.

Syntax

Pine Script
line.set_extend(id: series line, extend: series string) -> void
line.set_extend(extend: series string) -> void

Arguments

NameTypeDefaultDescription
idseries linerequiredThe line whose reach past its two points changes.
extendseries stringrequiredextend.none stops at the points; extend.left, extend.right or extend.both continue the line along its slope.

Returns

Nothing.

Remarks

  • On Sidechair: a line whose two x values are equal is drawn as it is and ignores extend.

Example

Pine ScriptOnly the newest pivot line runs to the rightOpen in editor
//@version=6
indicator("line.set_extend: newest only", overlay = true)
ph = ta.pivothigh(high, 5, 5)
var line prev = na
if not na(ph)
    line.set_extend(prev, extend.none)
    prev := line.new(bar_index - 5, ph, bar_index, ph, extend = extend.right)

See also

Runs on Sidechair