line.new

Draws a line from (x1, y1) to (x2, y2) and returns its handle. x is a bar index (xloc.bar_index) or a UTC ms time (xloc.bar_time); a time past the last bar is drawn in the space after it. Keep the handle (var line l = ...) to move it later with line.set_*; the oldest lines are deleted past max_lines_count.

line.new(x1: int/float, y1: int/float, x2: int/float, y2: int/float, xloc: string = "bar_index", extend: string = "none", color: color = color.blue, style: string = "solid", width: int = 1, force_overlay: bool = false) -> line
line.new(first_point: @chart.point, second_point: @chart.point, xloc: string = "bar_index", extend: string = "none", color: color = color.blue, style: string = "solid", width: int = 1, force_overlay: bool = false) -> line

Parameters

Example

var line l = na
if session.isfirstbar
    l := line.new(bar_index, open, bar_index + 10, open, color=color.amber)