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
pointsarray<@chart.point>: An array<chart.point> in drawing order; points with an na coordinate are skipped.curvedbool: true: a smooth curve through the points; false (default): straight segments.closedbool: true: the last point joins the first and fill_color fills the inside.xlocstring: xloc.bar_index (the points' index) or xloc.bar_time (their time)line_colorcolor: The line color; na draws no line.fill_colorcolor: na fills nothingline_stylestring: line.style_solid, style_dashed or style_dottedline_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.
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)