Writing an alert

The condition, the message, and when it may repeat.

AlgoBarsX
alert "RSI bullish divergence"
check: every 15m
repeat: once per bar
show_on_chart: true
input rsi_length = 14
input lookback = 30
momentum_now = rsi(close, rsi_length)
lower_low = low < lowest(low, lookback)[1]
higher_rsi = momentum_now > lowest(momentum_now, lookback)[1]
when lower_low and higher_rsi and was(momentum_now < 30, within: 5 bars):
notify "Bullish RSI divergence on {market.symbol}: RSI {momentum_now:0.0}"
SettingWhat it does
checkHow often the condition is checked, such as every 1m.
repeatonce, once per bar (the default), once per bar close or every time.
cooldownThe shortest gap between two messages.
expiresWhen the alert stops watching.
show_on_chartMarks the chart where it fired.

notify sends the message. In version 1 it is delivered in the app and in AI chat. Testing an alert shows you the messages it would have sent and the ones its own settings held back.

Alerts that watch the account, not the chart

AlgoBarsX
alert "Margin and exposure"
check: every 5m
repeat: once
expires: 30d
when account.free_margin < 20% of account.equity or positions.len >= 8:
notify "Free margin {account.free_margin:$0} with {positions.len} open positions"

More: Daily risk guard, Intrabar spike, Tokyo open gap, Distribution shift.

Try this in the Terminal. AlgoBars is free: $0 a month, no card needed.

Create my free account