Skip to main content

Signature

key is a unique string identifying this line’s slot. Calling Line with the same key replaces the prior line. See entities overview for the slot model.

Quick example

Options

number
required
Start x coordinate as a bar index.
number
required
Start y coordinate as a price level.
number
required
End x coordinate as a bar index.
number
required
End y coordinate as a price level.
string
Line color as #RRGGBBAA hex. Default: chart accent color.
number
Line width in pixels. Default: 1.
string
Line style. One of: "solid", "dotted", "dashed", "arrow.right", "arrow.left", "arrow.both". Default: "solid".
string
Optional text label rendered near the line midpoint.
number
Stacking order. Higher values render on top. Default: 0.
boolean
When true, renders in the main price pane even if the indicator is on a sub-pane. Default: false.

Style enum values

You can also use the linestyle.* constants:

Handle methods

Dynamic S/R line example

LineFill

Shade the area between two Line entities.

Box

Rectangular zone - use when you need width and height.

Constants

linestyle.* enum values.

Support/resistance example

Full working example using Line entities.