Diagnostics
S021
trigger must be called on a declared alert
S021
Each .trigger call must identify exactly one alert declaration. Call it on the declaration's binding or a plain alias, never on a conditional, collection, or call selection.
Failing example
script "conf"
alert up = alert(title: "Up")
alert down = alert(title: "Down")
data chart = subscribe(data.ohlcv)
on chart.update {
((chart.close ?? 0.0) > 0.0 ? up : down).trigger()
}Corrected example
script "fixed"
alert up = alert(title: "Up")
alert down = alert(title: "Down")
data chart = subscribe(data.ohlcv)
on chart.update {
if (chart.close ?? 0.0) > 0.0 {
up.trigger()
} else {
down.trigger()
}
}