Skip to content

Rune Script

Rune Script is Crodl's scripting language for building chart indicators, alert logic, and backtestable strategies.

Launch Rune is script(version=1). That is the public language surface shipping on Crodl today.

What Rune Is Good At

Rune is designed for:

  • Indicators — moving averages, bands, oscillators, structure overlays, custom chart logic
  • Alerts — named alert series that can be used in Crodl alert workflows
  • Strategies — entries, exits, pending orders, risk-sized positions, and managed protection
  • Dashboards — lightweight panel blocks for live status and backtest trade logs
  • MTF and external feeds — same-market higher timeframe streams and host-supplied external OHLCV streams

Rune is intentionally not a Pine clone. It keeps the language declarative and avoids imperative chart-object APIs, loops, and request.security()-style scripting.

Where Rune Runs

Rune uses different runtime surfaces for different jobs:

  • Backend preview is the authoritative chart preview path for saved scripts
  • Local Backtester is the authoritative execution and backtest path
  • Browser runtime is used for editor assistance, validation feedback, and optimistic draft help

That split matters because chart preview and backtest execution are both real product features, but the local node remains the truth source for fills, trade logs, and execution-grade results.

Your First Rune Script

script(name="EMA Breakout", version=1, mode=indicator, overlay=true)
 
param fast_len = int("Fast EMA", 20, min=1, max=200, group="Trend")
param slow_len = int("Slow EMA", 50, min=1, max=400, group="Trend")
param marker_color = color("Marker", "#00E676", group="Style")
 
stream market = ohlcv()
 
panel status:
  title "EMA Breakout"
  metric fast = ema(market.close, fast_len) format="price"
  metric slow = ema(market.close, slow_len) format="price"
  status bias = market.close > ema(market.close, slow_len) tone="success"
 
bar:
  let fast = ema(market.close, fast_len)
  let slow = ema(market.close, slow_len)
  signal bull_cross = cross_up(fast, slow)
  alert breakout = bull_cross
 
  draw(type=line, series=fast, color=marker_color, width=2)
  draw(type=line, series=slow, color=signal_short, width=2)
  draw(type=marker, shape=triangleup, when=bull_cross, at=market.low, color=marker_color)

This script:

  1. declares launch Rune v1 in the script header
  2. creates typed UI parameters
  3. binds the chart OHLCV feed through stream market = ohlcv()
  4. computes two moving averages every bar
  5. emits both a named signal and a named alert
  6. renders chart lines plus a marker
  7. shows live values in a panel

Core Building Blocks

Every Rune script starts with the same broad structure:

script(name="...", version=1, mode=indicator|strategy, overlay=true|false)
 
param ...
stream ...
keep ...
calc helper(...):
  return ...
 
panel name:
  title "..."
  metric ...
  status ...
 
risk:
  ...
 
bar:
  let ...
  guard ...
  rule ...
  signal ...
  alert ...
  draw(...)
  trade(...)
  protect(...)

Not every script uses every block, but this is the launch surface you should expect across Crodl docs, presets, and examples.

Script Types

TypePurposeCan trade?
IndicatorChart visuals, series, panels, alertsNo
StrategyEverything an indicator can do, plus trade(...) and protect(...)Yes

Indicator scripts can still emit named alerts and panels. Strategy scripts add entries, exits, pending orders, managed stops, targeted exits, and richer risk controls.

Saving, Publishing, and Access

Rune scripts support the standard Crodl script lifecycle:

  • Private — only you, or users you explicitly grant, can view or run the script
  • Open source — code is visible and reusable
  • Open read-only — users can apply, alert, and backtest the script without receiving the raw source

Protected scripts execute by saved revision through backend authority. They are not meant to rely on raw code being present on the client.

Backtesting and Alerts

Rune strategies can:

  • place market, limit, and stop entries
  • place pending exits
  • size entries with size=pct(...) or risk=cash(...) / risk=equity_pct(...)
  • manage active positions with protect(...)
  • expose named alert series for Crodl alert workflows

The chart preview and the backtester share the same language contract, but the Local Backtester remains authoritative for trade execution details.