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) → voidParameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | Yes | — | Unique ID. |
cond | series bool | Yes | — | Condition. |
x1 | int | Yes | — | Left bar_index. |
y1 | float | Yes | — | Start price. |
x2 | int | Yes | — | Right bar_index. |
y2 | float | Yes | — | End price. |
options | object | Not specified | — | { color, lineWidth, style, extend, mode } |
Returns
voidExample
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.