scripting
Script kinds
Indicator, Alert, Screener, Drawing, Strategy — what each surface does and how it differs.
The same DSL targets five surfaces. Each kind has slightly different
semantics — what output means, what runs at evaluation time, and where
the result shows up.
Indicator
Plots a series or oscillator on the chart. output is the value you
expose to other scripts (you can chain indicators).
let r = rsi(close, 14)
plot(r, pane: "rsi")
output r
Runtime: chart preview, instant. No order capability.
Alert
output is a boolean. The runtime fires notify(...) whenever it goes
true on a bar close. Pro tier sends through a 24/7 cloud worker.
let trigger = close > sma(close, 200) and volume > sma(volume, 20) * 2
notify(when: trigger, channel: "discord")
output trigger
Screener
A loop that yields symbols matching a condition. Runs across a watchlist on a configurable schedule.
for sym in watchlist("us-large-cap") {
let hit = rsi(close, 14) < 30 and close > vwap()
if hit { yield sym }
}
Drawing
Programmatic shapes on the chart. No output — side effects only.
let pivot = high[1]
draw_zone(top: pivot, bottom: pivot - atr(14), fill: accent, opacity: 0.1)
Strategy
Order-emitting code. Backtests against the same fill engine that runs
live. The auto-flip rule converts an indicator-style boolean to long/flat
positions when no explicit buy/sell calls exist.
let fast = sma(close, 12)
let slow = sma(close, 26)
if cross_up(fast, slow) { buy(qty: 1) }
if cross_down(fast, slow) { sell_all() }
Decision matrix
| Need | Use | |---|---| | Plot a line | Indicator | | Get notified at a price condition | Alert | | Filter a watchlist daily | Screener | | Highlight zones | Drawing | | Generate orders | Strategy |