Documentation
1. Backtesting Overview
- Created
- Jun 5, 2026
- Updated
- Jun 5, 2026
Backtesting runs strategy logic against historical bars and reports how it would have performed — trades, an equity curve, and a full set of performance statistics — all inside the same workspace as your charts.
The Strategy Tester
Backtests run in the Strategy Tester panel. Open it from the toolbar or launch the workspace into it with /chart/BTCUSDT?panel=backtesting. The panel has four tabs:
| Tab | Purpose |
|---|---|
| Compose | Write or load the strategy and run it. |
| Performance | Headline metrics and detailed performance breakdowns. |
| Trades | The list of individual trades the strategy took. |
| Code | The exact strategy source that produced the result. |
How it works
- A strategy is a small program with
initandnexthooks.nextruns once per bar, oldest to newest, and submits orders through a broker model. The full authoring contract is covered in Writing Strategies and the Strategy API Reference. - The test runs over the bars loaded for the active pane's symbol and timeframe, so the timeframe you backtest on is the one you are charting.
- Strategies can read indicator and chart-pattern values as they run — see Composing Indicators & Patterns.
- Results always include a buy-and-hold benchmark so you can judge the strategy against simply holding the instrument.
What you can tune
The broker model is configurable: starting capital, commissions, slippage, position sizing, pyramiding, and order-fill rules. These are covered in Strategy & Test Settings.
Next steps
Run your first backtest from a template.