Skip to content
Algo Trade Analytics Docs

line.new() - Pine Script Function

Creates new line object.

line.new(first_point, second_point, xloc, extend, color, style, width, force_overlay) → series line
NameTypeDescription
first_pointchart.pointA chart.point object that specifies the line’s starting coordinate.

Line ID object which may be passed to line.setXXX and line.getXXX functions.

//@version=6
indicator("line.new")
var line1 = line.new(0, low, bar_index, high, extend=extend.right)
var line2 = line.new(time, open, time + 60 * 60 * 24, close, xloc=xloc.bar_time, style=line.style_dashed)
line.set_x2(line1, 0)
line.set_xloc(line1, time, time + 60 * 60 * 24, xloc.bar_time)
line.set_color(line2, color.green)
line.set_width(line2, 5)