Sidechair

extend.* constants

Browse the reference

How a line or box continues past its anchor points: extend.none, extend.left, extend.right or extend.both.

Try it in the editor

extend.* constants go in the extend argument of line.new, box.new and their set_extend functions. extend.none stops the object at its anchor points and is the default. extend.right runs it to the right edge of the chart, extend.left to the left edge, and extend.both across the whole chart.

The direction is relative to the chart, not the line: extend.right continues past whichever of the two points is further right.

Constants

NameValueDescription
extend.bothContinue in both directions, across the whole chart.
extend.leftContinue to the left edge of the chart.
extend.noneStop at the anchor points; the default.
extend.rightContinue to the right edge of the chart.

Remarks

  • An extended line keeps following new bars on the right as they arrive.

Example

Pine ScriptExtend a level to the rightOpen in editor
//@version=6
indicator("Extended high", overlay = true)
top = ta.highest(high, 100)
bottom = ta.lowest(low, 100)
if barstate.islast
    line.new(bar_index - 100, top, bar_index, top, extend = extend.right, color = color.red, style = line.style_dashed)
    line.new(bar_index - 100, bottom, bar_index, bottom, extend = extend.both, color = color.green)
plot(close, "Close", color.gray)

See also

Runs on Sidechair