Backtest a strategy
Backtesting runs strategy logic over historical candles and stores metrics/artifacts for inspection.
Basic Command Shape
npx @tradejs/cli backtest --user root --config <StrategyName:configName> --tickers BTCUSDT --timeframe 15 --tests 1 --parallel 1
The selected config must exist in Redis. The deterministic sandbox in Run your first backtest seeds one for you; for your own strategy, see Create a backtest config.
Useful Flags
--config: backtest config key--tickers: comma-separated symbol list--timeframe: candle interval--tests: max tests--parallel: worker count--cacheOnly: do not refresh market cache--updateOnly: update market cache without running tests--ml: export ML rows--ai: export AI prompt rows--runId: continue a resumable run
Practical Workflow
- Start with one strategy, one symbol, and one config.
- Confirm entries and exits are explainable.
- Expand the symbol/time window.
- Compare variants with the same assumptions.
- Review Backtesting caveats before promoting anything to runtime.