Skip to content
AlertaChartAlertaScript / docs
AlertaScript / alerta.drawLine
On this pageSignatureParametersReturnsExampleNotes

Drawing / Reference

alerta.drawLine

TradingView-compatible spelling: line.new, runs without warnings

Draws a persistent trendline or simple line between two points.

alerta.drawLine(id, cond, x1, y1, x2, y2, options) → void

Parameters

NameTypeRequiredDefaultDescription
idstringYes—Unique ID.
condseries boolYes—Condition.
x1intYes—Left bar_index.
y1floatYes—Start price.
x2intYes—Right bar_index.
y2floatYes—End price.
optionsobjectNot specified—{ color, lineWidth, style, extend, mode }

Returns

void

Example

alerta.drawLine
isBOS = bar_index > 10lastPivotX = bar_index - 5lastPivotY = high[5]drawLine("BOS_" + bar_index, isBOS, lastPivotX, lastPivotY, bar_index, lastPivotY, { color: "gray", mode: "append" })

Notes

  • Legacy alias: prefer object API (`line.new` + `line.set_*`) for Pine parity.

Names and aliases

Guides and navigation are localized. Built-in reference descriptions and code examples are maintained in English.

AlertaScript

No results found.

Search by name, alias, or keyword.