Guides
StrateScript developer guide
StrateScript is the scripting language built into Strate. You use it to write your own indicators, simulated strategies and studies, and run them on any chart. Scripts can read data at every level of detail:
- bars: OHLC, volume, delta and footprint;
- every trade, one by one;
- the aggregated order book;
- the full order-by-order (MBO) stream: every add, cancel, modify and fill, with queue positions.
This guide is for traders who want to write scripts themselves. You do not need to know Rust or any other particular language: if you have written a spreadsheet formula or a short script before, you have enough background. Strate AI can also write scripts for you, but nothing in this guide depends on it.
Every complete example in this guide passes the same check the app runs on your code before it executes. When an example says what it prints, that output was produced by the engine.
How to read this guide#
- Start with Getting started. It takes you from an empty editor to a named indicator saved in My indicators.
- Read The language once from top to bottom. It is the longest guide page, but it explains the few rules that differ from other languages: how variables are reset on each bar, and how
nabehaves. - Then go to the topic you need. The reference pages are for looking things up.
Map of the guide#
| Page | What it covers |
|---|---|
| Getting started | First indicator, step by step: where to write code, checking, running, settings, saving to My indicators |
| The language | Syntax, script kinds, headers, types, variables, operators, control flow, functions, custom types, collections, history, budget |
| Market data | Bars, footprint, sessions and hours, other timeframes and instruments, trades one by one, what is available in live, Replay and long backtests |
| Order flow | Order-by-order (MBO) events, the order book, level statistics, the of module, history windows, worked examples (absorption, iceberg refills, pulled liquidity) |
| Patterns, clocks and signals | Event handlers, pattern blocks, custom clocks, on signal, the shipped pattern library |
| Normalization | The norm module: comparing a measure with its own recent values (rank, z-score, ratio to median) |
| Plotting | Plots, histograms, fills, levels, markers, labels, boxes, tables, cells in the bar column, colors, panes, scales |
| Settings | input.* functions, the Settings tab, units (ticks, points), settings that pick a price or a time on the chart |
| Alerts | alert(), how often it fires, sound and notifications, alerts in Replay |
| Strategies | Simulated orders, stops and targets, units, costs, fill models, latency, the Report, equity curve, CSV export, sweeps, long backtests, MBO start |
| Research | Measuring what happens after a signal: study(), report(), compare(), the research report |
| Reference: functions | Every built-in function, field and method, with parameters, defaults and return values |
| Reference: errors | Every error code, its message, cause and fix |
| Reference: limits | Bounds, memory, performance, and what is not supported |
| Examples | Complete, commented scripts, from a moving average to MBO absorption |
Conventions used in this guide#
- Code is shown in
monospace. Complete scripts are in code blocks and can be pasted into the editor as they are. - A comment like
// → 3 3 falseafter aprint(...)shows what the line prints on the last bar. - "Tick" is the instrument's minimum price increment (0.25 on ES). "Point" is one whole unit of price (1.00 on ES = 4 ticks).
- Times are New York time unless stated otherwise. The CME session runs from 18:00 to 17:00 the next day, and the regular trading hours (RTH) run from 9:30 to 16:00.
- "MBO" means market by order: the order-by-order feed, where each resting order is seen individually.