Skip to content

Polyline

Handle for a polyline drawing.

Static Methods

new

navi
Polyline.new(
    points: series Array<chart.Point>,
    curved: series bool = false,
    closed: series bool = false,
    xloc: series string = xloc.bar_index,
    line_color: series color = color.BLUE,
    fill_color: series color = na,
    line_style: series string = line.style_solid,
    line_width: series int = 1,
    force_overlay: series bool = false
  ): series Polyline

Creates a new polyline instance and displays it on the chart, sequentially connecting all of the points in the points array with line segments.

The segments in the drawing can be straight or curved depending on the curved parameter.

Parameters

NameTypeDefaultDescription
pointsseries Array<chart.Point>An array of chart.Point values defining the vertices of the polyline in the order they will be connected.
curvedseries boolfalseIf true, the segments between consecutive points are drawn as smooth curves. If false, straight line segments are used. Optional. The default is false.
closedseries boolfalseIf true, an additional segment is drawn from the last point back to the first, closing the shape. Optional. The default is false.
xlocseries stringxloc.bar_indexDetermines how the x-coordinate of each chart.Point is interpreted. Use xloc.bar_index to treat x as a bar index, or xloc.bar_time to treat x as a UNIX timestamp. Optional. The default is xloc.bar_index.
line_colorseries colorcolor.BLUEThe color of the line segments. Optional. The default is color.BLUE.
fill_colorseries colornaThe color used to fill the interior of the polyline when it is closed. na means no fill. Optional. The default is na.
line_styleseries stringline.style_solidThe style of the line. Possible values: line.style_solid, line.style_dotted, line.style_dashed, line.style_arrow_left, line.style_arrow_right, line.style_arrow_both. Optional. The default is line.style_solid.
line_widthseries int1The width of the line in pixels. Optional. The default is 1.
force_overlayseries boolfalseIf true, the polyline is drawn on the main chart pane regardless of which pane the script occupies. If false, it follows the script's pane. Optional. The default is false.

Returns: series Polyline

Static Properties

all

Type: series Array<Polyline>

Returns an array filled with all the current polylines drawn by the script.

Methods

delete

navi
Polyline.delete(id: series Polyline)

Deletes the specified polyline from the chart.

Parameters

NameTypeDefaultDescription
idseries Polyline

Released under the MIT License.