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
x1int/float: x of the first point. A bar index (bar_index), or a UTC ms time when the drawing uses xloc.bar_time.y1int/float: Price of the first point.x2int/float: x of the second point. A bar index (bar_index), or a UTC ms time when the drawing uses xloc.bar_time.y2int/float: Price of the second point.xlocstring: xloc.bar_index or xloc.bar_timeextendstring: extend.none, extend.left, extend.right or extend.bothcolorcolor: Line color (default color.blue); na hides the line.stylestring: line.style_*widthint: Width in pixels, rounded to a whole number (na = 1, below 0 = 0).force_overlaybool: Accepted for scripts from Pine and ignored: drawings stay in the script pane.first_point@chart.point: The first end. A chart.point: its index (xloc.bar_index) or its time (xloc.bar_time) is x, its price is y; na gives na coordinates.second_point@chart.point: The second end. A chart.point: its index (xloc.bar_index) or its time (xloc.bar_time) is x, its price is y; na gives na coordinates.
Example
var line l = na
if session.isfirstbar
l := line.new(bar_index, open, bar_index + 10, open, color=color.amber)