Skip to content
AlertaChartAlertaScript / docs
AlertaScript / alerta.iff
On this pageSignatureParametersReturnsExample

Utilities / Reference

alerta.iff

TradingView-compatible spelling: iff, runs without warnings

Pine v1/v2 compatibility helper. Returns the true branch when condition is truthy, otherwise the false branch. Works with scalar values and series.

alerta.iff(condition, trueValue, falseValue) → any or series any

Parameters

NameTypeRequiredDefaultDescription
conditionbool or series boolYes—Condition to evaluate.
trueValueanyYes—Value returned when condition is true.
falseValueanyYes—Value returned when condition is false.

Returns

any or series any

Example

alerta.iff
barColor = iff(close > open, color.green, color.red)plot(close, { color: barColor })

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.