Backtesting
Backtesting Guide
Test your trading strategies and signals on historical data to see how they would have performed in the past. This helps you validate strategy performance, optimize parameters, and understand risk characteristics before using real money.
Accessing Backtesting
Navigate to the Backtesting page in two ways:
- From Sidebar: Click "Backtesting" in the main navigation
- Direct URL: Visit
/backtestin the web dashboard
What You Can Test
Strategy Backtesting
Test complete trading strategies with full simulation
- Full trading strategy execution
- Entry signals (if configured)
- Grid levels and averaging
- Take profit and stop loss
- Trailing stop functionality
- Complete sequence lifecycle
Signal Backtesting
Test signal detection accuracy on historical data
- Signal detection only
- When signals would have triggered
- Signal strength and conditions
- No actual trading simulation
Key Features
- Real-Time Progress: Track backtest execution with progress bar, current candle info, and estimated time remaining
- Comprehensive Results: Detailed metrics, charts, and analysis
- Performance Attribution: Understand what drives returns:
- Attribution by direction (LONG vs SHORT)
- Attribution by close reason (take profit, trailing stop, max loss)
- Attribution by time period
- Attribution by grid level
- Attribution by sequence size
- Data Quality Indicators: See if results are based on reliable data
- Enhanced Metrics: Performance scoring, risk levels, and visual breakdowns
- Equity Curve Visualization: Dual Y-axis chart showing balance and return % over time
- Drawdown Analysis: Visual drawdown chart with peak-to-trough analysis
Results Include
- Summary Metrics: Initial balance, final balance, total return, sequence count
- Equity Curve: Visual performance over time with balance and return %
- Drawdown Chart: Area chart showing drawdown periods and maximum drawdown
- Enhanced Metrics: Performance score (0-100), risk level, performance badges
- Performance Attribution: Comprehensive breakdown by multiple dimensions
- Sequence Details: Complete history of all sequences with orders and PnL
- Data Quality Assessment: Quality score and warnings for data issues
Running a Strategy Backtest
Step 1: Select Configuration
- Option A: Use existing BotConfig from dropdown
- Option B: Use preset (Safe, Moderate, Aggressive, Very Aggressive)
Step 2: Configure Entry Signals (Optional)
- Use Signal Config or Signal Template
- Or leave empty for manual entry logic
Step 3: Set Date Range
- Use quick presets: "Last 7 days", "Last 30 days", "Last 90 days"
- Or select custom range via date picker
- Shorter periods run faster; longer periods provide more comprehensive results
Step 4: Configure Additional Settings
- Trading Pair: Select from available pairs (auto-populated if using config)
- Timeframe: Choose candle timeframe (1m-1d, default: 15m)
- Initial Balance: Starting balance (default: $10,000)
- Max Concurrent Sequences: Override limit (1-10)
Step 5: Run Backtest
- Click "Run Backtest"
- Track progress with real-time updates
- Results appear automatically when complete
Running a Signal Backtest
Step 1: Select Signal
Use Signal Config or Signal Template
Step 2: Set Parameters
- Select trading pair
- Timeframe auto-locked to signal's timeframe
- Set date range (presets or custom)
Step 3: Run Backtest
Results show total candles analyzed, signals detected count, and list of all signal triggers
Interpreting Metrics
Performance Score (0-100)
- 80-100: Excellent strategy, consider using in live trading
- 60-79: Good strategy, may need minor optimizations
- 40-59: Fair strategy, consider parameter adjustments
- 0-39: Poor strategy, significant changes needed
Based on win rate, profit factor, returns, and drawdown
Risk Level
- Low Risk: Drawdown ≤10% and Sharpe ≥1.5
- Medium Risk: Drawdown ≤20% and Sharpe ≥1.0
- High Risk: Otherwise
Key Metrics
- Win Rate: ≥50% good, ≥60% excellent
- Profit Factor: >1.0 profitable, ≥1.5 good, ≥2.0 excellent
- Max Drawdown: ≤10% low, 10-20% medium, >20% high
- Sharpe Ratio: ≥1.0 good, ≥2.0 excellent
- Sortino Ratio: ≥1.0 good, ≥2.0 excellent
Best Practices
✅ Date Range Selection
- Quick Testing: 7-30 days for faster execution and parameter tuning
- Comprehensive Analysis: 90+ days for reliable statistics and final validation
- Market Condition Testing: Test across bull, bear, sideways, and volatile periods
✅ Timeframe Selection
- Shorter (1m-15m): More granular, better for short-term strategies
- Longer (1h-1d): Less noise, better for longer-term strategies
- Match timeframe to your strategy's holding period
✅ Parameter Optimization
- Change one parameter per backtest
- Compare results systematically
- Test same config on different date ranges
- Use performance attribution to identify what works
✅ Interpreting Results
- Look beyond returns - consider risk (drawdown)
- Use multiple metrics, not just one
- Consider market conditions during test period
- Use performance attribution to understand what drives returns
Troubleshooting
No Results / Empty Results
- Try different date range
- Adjust signal parameters
- Check data availability for pair
- Verify config settings
Slow Backtest Execution
- Use shorter date range
- Use longer timeframe
- Wait for queue to clear
- Check progress indicator
Unexpected Results
- Review equity curve for patterns
- Check sequence breakdown
- Adjust parameters and re-test
- Test on different date ranges
Progress Not Updating
- Check if backtest completed
- Refresh page if stuck
- Check network connection
- Progress updates every 2 seconds
Prerequisites
- At least one BotConfig (for strategy backtests)
- Or at least one SignalConfig or template (for signal backtests)
- Historical data available for selected pair and date range
For complete backtesting documentation with detailed explanations, see the User Guide Backtesting section or access the backtesting interface at /backtest in the web dashboard.
All metrics in the interface have helpful tooltips - hover over the ℹ️ icon next to any metric for detailed explanations.