Skripte
Eine Skript-DSL, kein Indikator-Picker.
Fünf Skript-Arten, Tick-Zugriff, lokale Vorschau und Replay sowie eine isolierte 24/7-Laufzeit für geroutete Alerts — in einer Sprache.
01 · Fünf Arten, eine Sprache.
Fünf Arten, eine Sprache.
Indicator, Alert, Screener, Drawing, Strategy. Die Syntax ist gemeinsam; jede Art zielt auf eine bestimmte Oberfläche.
- Indicator — Fügt eine Serie oder einen Oszillator hinzu. Lebt in der Chart-Vorschau, ohne Overhead.
- Alert — Boolescher Ausdruck, ausgewertet bei jedem Bar-Close. Push, E-Mail oder Webhook — du wählst.
- Screener — Liefert die Symbole, die einer Bedingung entsprechen. Läuft nach Plan über eine Watchlist.
- Drawing — Programmatische Formen auf dem Chart — Supply/Demand-Zonen, FVGs, OBs, eigene Levels.
- Strategy — Order-emittierender Code. Backtested gegen dieselbe Fill-Engine, die live läuft.
// @spectra-script 2
let fast = ta.sma(close, 20)
let slow = ta.sma(close, 50)
plot.line("Fast", fast, color = color.teal)
plot.line("Slow", slow, color = color.orange)
output close > fast and fast > slow4 Zeilen. Plottet schnelle/langsame SMAs und gibt ein boolesches Signal aus.
02 · Eine DSL, drei Laufzeiten.
Eine DSL, drei Laufzeiten.
Einmal schreiben. Überall ausführen, wo ein Preis druckt.
- Chart-Vorschau — Tippen, die Linie zeichnet sofort. Bytecode wird bei jedem Tastendruck unter 80 ms neu kompiliert.
- Backtester — Gleiches Skript, Bar-für-Bar mit realistischem Slippage in Basispunkten, Provision pro Fill, Teil-Fills, Gap-Handling.
- VPS-Worker — Markiere ein Skript mit runs_on: vps und es feuert auf einem 24/7-Cloud-Worker — Alerts und Webhook-Orders inklusive.
VorherNachher03 · Tick scripting
React to the market one execution at a time.
Spectra Script v2 exposes the retained trade tape and a true per-print callback. Use it to inspect aggressor flow, dollar size, delta, print counts, and the largest execution without reducing the tape to candle closes.
- feed.tap(feed.trades) returns a bounded, newest-first execution window.
- on_trade(price, size, is_buy, ts) runs once for every valid print in timestamp order.
- Live tape retains 60 seconds and up to 10,000 prints; archive replay covers up to 24 hours and 10,000 prints.
- Unknown aggressor sides remain visible and are excluded from directional aggregates instead of being guessed.
// @spectra-script 2let minimum_usd = param.float("Minimum USD", 5000000.0, min = 1.0)fn on_trade(price, size, is_buy, ts) { alert.wire( "whale_buy", is_buy and price * size >= minimum_usd, message = "Large aggressive buy" )}output falseTrue trade callbacks · bounded state · deterministic replay
04 · Server runtime
Keep approved alerts running after you close the app.
Save an alert with a target symbol and timeframe, then route it to the server worker. Bar scripts execute on completed intervals; tick handlers receive the real aggressor stream in bounded 50 ms scheduler batches.
- Independent per-script state with tenant isolation and persisted fire timestamps.
- Hard CPU, memory, loop, and recursion budgets plus cancellation on overrun.
- Cooldown enforcement, runtime error capture, metrics, alert events, and outbound delivery.
- Strategies remain preview/backtest workflows; unattended server execution is deliberately limited to alert scripts.
// Runs on the saved symbol + timeframelet baseline = ta.sma(close, 200)let active = close > baseline and volume > ta.sma(volume, 20) * 1.5alert.wire( "volume_breakout", active, message = "Volume breakout confirmed")output activeRoute: VPS or Both · symbol + timeframe required
05 · Sandbox-Garantien.
Sandbox-Garantien.
Dein Alert kann deine Charts nicht killen. Jedes Skript läuft mit harten CPU- und Speicherbudgets, durchgesetzt auf VM-Ebene.
- Bytecode-VM, keine JS-Sandbox. Kein Zugriff auf die Host-Laufzeit.
- Pro-Skript-CPU-Budget (Default 50 ms) und Speicher-Decke (Default 16 MB).
- Cancellation-Tokens — ein lange laufendes Skript kann mid-bar gekillt werden.
- Keine `unsafe`-Pfade. Kein Datei- oder Netzwerkzugriff außer über geprüfte Built-ins.
Einmal schreiben. Überall traden.
Die volle Strategie-Sprache plus der 24/7-Cloud-Worker — gratis enthalten für jeden Trader während des Launches.
