Backtesting

Test your strategies on historical data before risking real money using QuantsEdge's Strategy Lab.

What is Backtesting?

Backtesting simulates how your strategy would have performed using past market data.

How It Works

  1. Choose a strategy and time period

  2. System replays historical price data

  3. Strategy generates buy/sell signals

  4. Simulated trades execute

  5. Performance calculated

Why Backtest?

Validate Logic - Does the strategy actually work? Are the rules sound? Set Expectations - Realistic return expectations, typical drawdowns, win rate Optimize Parameters - Find best settings, compare variations, refine approach Build Confidence - See strategy in action, understand behavior, trust before going live

Running a Backtest

1. Access Strategy Lab

Navigate to: Strategy Lab → Your Bot → Backtest

2. Configure Parameters

Time Period: Recent data (3 months), Longer validation (6-12 months), Multiple conditions (1-2 years) Starting Capital: Use your planned trading capital (e.g., $10,000) Trading Pair: Must match your bot's target (e.g., BTC-USD) Fees: Include realistic trading fees (default: 0.05%)

3. Run the Test

Click "Start Backtest" - Processing time: 30-90 seconds

What happens: Loads historical data, runs strategy logic, simulates order fills, calculates P&L and metrics

4. Review Results

Understanding Results

Key Metrics

Total Return - Overall profit/loss percentage. Good: 10-20% over 6 months, Excellent: 20%+, Warning: 50%+ might be over-optimized

Win Rate - Percentage of winning trades. Good: 50%+, Note: High win rate doesn't guarantee profitability

Profit Factor - Gross profits ÷ Gross losses. Good: Above 1.5, Excellent: Above 2.0, Warning: Below 1.3

Max Drawdown - Worst peak-to-valley decline. Acceptable: Under 20%, Good: Under 15%, Warning: Over 25%

Total Trades - Number of trades executed. Too few: <20, Good: 30-100, Too many: >200 (overtrading)

Performance Chart

Equity Curve - Shows capital growth over time. Look for: Steady upward trend, recovers from drawdowns, no single trade creates all profit

Red flags: Flat for long periods, large drawdowns, all profit from 1-2 trades

Interpreting Results

Good Backtest Signs

Positive total return (10%+), profit factor above 1.5, max drawdown under 20%, consistent performance over time, multiple winning periods, reasonable trade frequency

Warning Signs

Over-Optimization: Perfect 90%+ win rate, huge returns (100%+), almost no drawdown, won't work live Curve Fitting: All profit from one period, different results in different periods, too good to be true Insufficient Data: Only 5-10 trades, too short time period, need more testing

What If Results Are Bad?

Negative returns: Try different parameters, test different strategy type, current market might not suit strategy

Don't abandon immediately:

  • Some strategies work only in certain conditions

  • Test on different time periods

  • Understand why it lost

Backtest Best Practices

Time Period Selection

Include Multiple Conditions: Bull markets, bear markets, sideways markets, high and low volatility

Walk-Forward Testing

Better validation method: Backtest on Period 1, optimize parameters, test on Period 2. If still profitable → good sign, if not → was over-fit

Out-of-Sample Testing

Reserve data for validation: Backtest on 70% of your data for optimization, then test on the remaining 30% for validation. If validation fails, your strategy is over-optimized.

Realistic Settings

Include All Costs: Factor in trading fees (0.05% typical), slippage (0.1-0.2%), and funding rates for perpetuals to get accurate results.

Use Realistic Fills: Market orders should assume some slippage, while limit orders should use conservative fill assumptions based on market conditions.

Common Backtest Mistakes

Testing Only Bull Markets: Only backtesting during rising prices gives misleading results. Test across different market conditions including bear markets, sideways markets, and high volatility periods.

Over-Optimizing Parameters: Testing 100 parameter combinations and choosing the best one leads to overfitting. Test only 3-5 logical variations maximum to avoid curve-fitting.

Ignoring Drawdowns: Only looking at total return is dangerous. Maximum drawdown is as important as returns and shows the real risk of your strategy.

Too-Short Time Periods: Backtesting only 2-4 weeks isn't sufficient. Use a minimum of 3 months, preferably 6-12 months of data for reliable results.

Assuming Perfect Execution: Expecting exact entry/exit prices is unrealistic. Always include realistic costs and slippage in your backtests.

After Backtesting

If Results Are Good

Next step: Paper Trading - Don't go straight to live trading. Paper trade for 1-2 weeks minimum to verify live behavior matches your backtest, build confidence, then deploy small live positions.

Paper Trading Guide →

If Results Are Mixed

Options: Adjust parameters carefully, try different time periods, test a different strategy entirely, or combine with other strategies for diversification.

Don't: Keep tweaking until "perfect," skip paper trading, or risk real money yet.

If Results Are Bad

Don't force it: Sometimes strategies simply don't work for certain markets. Try a completely different approach or accept that some ideas don't work in practice.

  • Better to know now than after losing money

Backtest Limitations

What Backtesting Can't Tell You

Future Market Conditions

  • Past performance ≠ future results

  • Markets change

  • New conditions emerge

Psychological Factors

  • How you'll handle real losses

  • Emotional discipline

  • Stress of real money

Exact Live Performance

  • Slippage varies

  • Liquidity changes

  • Technical issues can occur

Black Swan Events

  • Extreme market crashes

  • Exchange outages

  • Unprecedented volatility

Why You Still Need Paper Trading

Backtesting is essential but not sufficient:

  • Paper trading tests real-time execution

  • Reveals current market behavior

  • Builds psychological readiness

  • Final validation before live

Never skip paper trading.

Quick Checklist

Before Running Backtest

After Backtest Results

Next Steps

Passed Backtesting? Move to paper trading to validate in real-time. Paper Trading Guide →

Want to Optimize? Learn advanced parameter tuning. Strategy Optimization →

Analyze Deeply Understand performance metrics. Performance Analysis →


Backtesting is your first defense against bad strategies. Take it seriously, but remember it's only the first step in validation.

Last updated