scripting
Built-in functions
The standard library of indicators, math helpers, signal primitives, and order calls.
Built-ins are grouped by surface. Every one is type-checked and runs inside the sandbox.
Time series
| Name | Returns |
|---|---|
| sma(src, n) | series<float> — simple moving average |
| ema(src, n) | series<float> — exponential moving average |
| rma(src, n) | series<float> — Wilder's smoothing |
| highest(src, n) | series<float> — rolling max |
| lowest(src, n) | series<float> — rolling min |
| stdev(src, n) | series<float> — rolling standard deviation |
| change(src) | series<float> — src - src[1] |
Indicators
rsi(src, n) // 0–100
macd(src, fast, slow) // returns {line, signal, hist}
atr(n) // average true range
vwap(anchor: ...) // anchored VWAP
Signals
cross_up(a, b) // a was ≤ b last bar, > b this bar
cross_down(a, b)
pivot_high(src, n)
pivot_low(src, n)
Output and rendering
plot(value, color: ..., width: ..., pane: "...")
mark(condition, label: "...", color: ...)
band(upper, lower, color: ..., fill: ...)
draw_zone(top: ..., bottom: ..., fill: ..., opacity: ...)
notify(when: ..., channel: "...")
Orders (Strategy kind only)
buy(qty: ..., sl: ..., tp: ...)
sell(qty: ..., sl: ..., tp: ...)
sell_all()
Constants
close, open, high, low, volume // current bar OHLCV series
bar(N) // timestamp of bar N
accent, bull, bear, warning, info // theme colors
Individual trades
Bind the source before calling its methods:
let tape = feed.tap(feed.trades)
let biggest = tape.largest()
output biggest.side_known and biggest.usd >= 1000000
The trades surface includes len, price, size, usd, is_buy,
side_known, time, window_ms, buy_vol, sell_vol, delta,
count_buys, count_sells, max_size, largest, and since. Index zero
is the newest print. Read the complete runtime contract in
Tick-based scripting.
The full reference catalogues every signature and every parameter — see the language reference index page.