polyline.new

Draws a path through an array of chart.point and returns its handle: straight segments, or a smooth curve with curved=true; closed=true joins the last point to the first and fill_color fills the inside. It does not change afterwards (make a new one and delete the old). At most 10,000 points; the oldest of more than 100 polylines is deleted.

polyline.new(points: array<@chart.point>, curved: bool = false, closed: bool = false, xloc: string = "bar_index", line_color: color = color.blue, fill_color: color = na, line_style: string = "solid", line_width: int = 1, force_overlay: bool = false) -> polyline

Parameters

Example

if barstate.islast
    pts = array.new<chart.point>()
    for i = 0 to 20
        pts.push(chart.point.from_index(bar_index - i, close[i]))
    polyline.new(pts, line_color=color.amber)