Spectra
Browse docs

alerts

Script alerts

DSL-driven alerts that fire on any expression you can express in the scripting language.


A script alert is an Alert-kind script (see Script kinds) tagged for live evaluation. The output is a boolean; the runtime calls notify(...) whenever it goes true on a bar close.

Minimal example

let oversold = rsi(close, 14) < 30
let near_vwap = abs(close - vwap()) < atr(14) * 0.5
let trigger = oversold and near_vwap

notify(when: trigger, channel: "discord")
output trigger

Symbols and timeframes

By default a script alert evaluates against the chart it was attached to. Change it from Alert settings:

Symbol     →  same as chart  |  named: ES1!, BTCUSDT, ...
Timeframe  →  same as chart  |  fixed: 1m, 5m, 1h, 1d

You can run the same alert across an entire watchlist by setting Symbol = watchlist:<name>. The runtime fans out one evaluation per symbol per bar close.

Cooldown

Alerts default to fire once and disable to avoid spam. Override:

Cooldown  →  off  |  fire once  |  re-arm after N bars  |  always

always plus a debounced expression (e.g. trigger and not trigger[1]) is the cleanest pattern for state-change alerts.

Pro features

Pro adds:

  • 24/7 evaluation on the cloud worker (runs_on: vps).
  • Webhook outputs that can trigger orders downstream — see Webhooks.
  • Email digest mode that batches multiple fires per day.

Debugging

Open Alert settings → Diagnostics for a per-bar evaluation log: the last 50 evaluations, the boolean output, and the time taken. Useful when an alert isn't firing and you suspect a typo.