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 anyParameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
condition | bool or series bool | Yes | — | Condition to evaluate. |
trueValue | any | Yes | — | Value returned when condition is true. |
falseValue | any | Yes | — | Value returned when condition is false. |
Returns
any or series anyExample
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.