backtest_strategy
Backtest a trading strategy on historical data for any symbol, with custom parameters, fees, and slippage, to evaluate its real edge against buy-and-hold.
Instructions
Backtest one strategy on one instrument.
Args: symbol: Ticker (BTC, AAPL, BBCA). strategy: Strategy name from list_strategies. market: "crypto", "stock" or "idx". interval: Candle size (15m, 30m, 1h, 4h crypto-only, 1d, 1w). bars: Candles to test over (30-1500). params: Strategy parameter overrides, e.g. {"period": 21}. fee_bps: Round-trip fee in basis points per position change. slippage_bps: Assumed slippage in basis points per position change. include_trades: Return the full trade log as well as the metrics.
Signals are acted on at the next bar, so results contain no
look-ahead. Always compare total_return_pct against
buy_and_hold_return_pct — beating a flat market is not an edge.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bars | No | ||
| market | No | crypto | |
| params | No | ||
| symbol | Yes | ||
| fee_bps | No | ||
| interval | No | 1d | |
| strategy | Yes | ||
| slippage_bps | No | ||
| include_trades | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||