Code editor
Write strategies in Python with the stlab library — full control, live validation, multi-timeframe.
The Editor tab is the no-limits surface: anything the engine supports, you can write. Strategies are Python built on the stlab library — a few lines for a simple idea, or multi-timeframe logic with custom costs for a serious one. The language itself is documented in the Python DSL reference.
The workflow
- Write (or paste) your strategy — the editor seeds a working RSI example you can edit, and code from the AI Strategy tab or any external assistant drops straight in.
- Structural problems (missing entry/exit) surface as you type, and hitting Run first triggers a free server-side dry-run that catches unknown indicators and runtime errors — either way, nothing costs a run until the code actually executes.
- Run backtest — pick market, interval, period. Results land on the standard result page with the Reality check.
- Save to My Strategies to keep it: saved strategies can be re-run, swept, opened on the chart, or published.
Editing on the chart
The chart hosts a lightweight version of the same editor in its bottom panel, bound to the chart's market and timeframe — handy for iterating on thresholds while watching the candles they trade. The full tab remains the home for longer scripts.
Tips
- Keep the Python DSL reference open — every function, default, and limit is listed there.
- Model costs (stlab.cost.commission / slippage) from the start; a zero-cost backtest flatters every strategy and the Reality check will say so.
- Multi-timeframe: reference stlab.candles_1d (and friends) directly — alignment is automatic and look-ahead-safe.