extend

The extend namespace provides constants that control how lines are extended beyond their start and end points. These constants are used with line.new() and line.set_extend() to specify the extension direction.

Quick Example

from pynecore.lib import script, line, extend, close, bar_index, ta

@script.indicator(title="Trend Line with Extension", overlay=True)
def main():
    if ta.crossover(close, ta.sma(close, 20)):
        ln = line.new(bar_index, close, bar_index + 1, close, extend=extend.right)

Constants

ConstantDescription
extend.bothExtend the line in both directions (left and right)
extend.leftExtend the line to the left beyond the start point
extend.noneDo not extend the line (default behavior)
extend.rightExtend the line to the right beyond the end point