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:

TabPurpose
ComposeWrite or load the strategy and run it.
PerformanceHeadline metrics and detailed performance breakdowns.
TradesThe list of individual trades the strategy took.
CodeThe exact strategy source that produced the result.

How it works

  • A strategy is a small program with init and next hooks. next runs 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.

Next: Running Your First Backtest