Alerts from scripts
alert() fires a message; alertcondition() declares a condition the host can deliver.
//@oxscript=1
indicator("RSI alerts")
r = ta.rsi(close, 14)
plot(r, "RSI", color=color.purple)
hline(70, "Overbought")
hline(30, "Oversold")
alertcondition(ta.crossover(r, 70), "RSI overbought", "RSI crossed above 70")
if ta.crossunder(r, 30)
alert("RSI crossed below 30", alert.freq_once_per_bar)- Alerts fire on live bars. Fired alerts show as a toast and in the OxScript panel's Alerts list, newest first.
alertconditiondeclares the condition; the host receives it and decides how to deliver it (push, sound, SMS).