Skip to main content

Backtesting Strategies

Test your trading strategy on historical data to evaluate performance before risking real capital.

What is backtesting?

Backtesting simulates how your strategy would have performed in the past by:

  1. Fetching historical price data for your symbol and timeframe
  2. Calculating indicators on historical candles
  3. Generating entry and exit signals based on your conditions
  4. Simulating trade execution with realistic fees and slippage
  5. Calculating comprehensive performance metrics

Important: Past performance does not guarantee future results, but backtesting helps identify flawed strategies before deployment.

Running a backtest

Step 1: Open your strategy

  1. Navigate to Strategy Builder
  2. Select a draft or saved strategy
  3. Click Backtest button

Step 2: Configure backtest parameters

Date range:

  • Start date: Beginning of historical test period
  • End date: End of historical test period
  • Recommended: At least 3-6 months of data

Initial capital:

  • Starting account balance for simulation
  • Default: $10,000
  • Use realistic amount you plan to trade with

Example configurations:

Short-term test (1 month):

Start: 2024-01-01
End: 2024-02-01
Initial Capital: $5,000

Medium-term test (6 months):

Start: 2023-07-01
End: 2024-01-01
Initial Capital: $10,000

Long-term test (1 year):

Start: 2023-01-01
End: 2024-01-01
Initial Capital: $10,000

Step 3: Run backtest

  1. Click Run Backtest button
  2. Wait for processing (typically 5-30 seconds)
  3. Review results

Processing time depends on:

  • Date range length
  • Timeframe (5m takes longer than 1d)
  • Number of indicators
  • Complexity of conditions

Understanding backtest results

Performance summary

Total return:

  • Percentage gain or loss from initial capital
  • Example: 25% means $10,000 grew to $12,500

Net profit/loss:

  • Dollar amount gained or lost
  • Example: $2,500 profit on $10,000 initial capital

Win rate:

  • Percentage of profitable trades
  • Formula: (Winning trades / Total trades) × 100
  • Good: >50%, Excellent: >60%

Profit factor:

  • Ratio of gross profit to gross loss
  • Formula: Total profit from wins / Total loss from losses
  • Good: >1.5, Excellent: >2.0
  • Below 1.0 means strategy loses money

Risk metrics

Maximum drawdown:

  • Largest peak-to-trough decline in account value
  • Expressed as percentage
  • Example: 15% means account dropped 15% from highest point
  • Good: less than 20%, Acceptable: less than 30%, Warning: greater than 30%

Sharpe ratio:

  • Risk-adjusted return measure
  • Higher is better
  • Good: greater than 1.0, Excellent: greater than 2.0
  • Negative means returns don't justify risk

Average win vs average loss:

  • Compares typical winning trade to typical losing trade
  • Good: Average win greater than Average loss
  • Excellent: Average win greater than 2× Average loss

Largest win/loss:

  • Single biggest profitable and losing trade
  • Check if strategy relies on one lucky trade
  • Consistent profits better than one huge win

Trade statistics

Total trades:

  • Number of positions opened and closed
  • Too few (less than 10): Not enough data to judge
  • Too many (more than 100/month): May be overtrading

Winning trades:

  • Number of profitable positions
  • Should be more than 40% of total

Losing trades:

  • Number of unprofitable positions
  • Normal to have losses; focus on overall profitability

Average trade duration:

  • How long positions stay open
  • Should match your strategy type:
    • Scalping: Minutes to hours
    • Day trading: Hours to 1 day
    • Swing trading: Days to weeks

Average profit per trade:

  • Mean profit across all trades
  • Should be positive after fees
  • Higher is better, but consistency matters more

Equity curve

Visual representation of account balance over time.

What to look for:

Steady upward trend:

  • Consistent growth over time
  • Small, manageable drawdowns
  • Indicates robust strategy

Erratic curve:

  • Large swings up and down
  • Deep drawdowns
  • High volatility in returns
  • May indicate luck rather than skill

Flat or declining:

  • No growth or losses
  • Strategy not working
  • Don't deploy

One big spike:

  • Single large win drives all profit
  • Not sustainable
  • Likely lucky trade, not repeatable

Monthly and weekly analysis

Monthly returns:

  • Profit/loss breakdown by month
  • Check for consistency
  • Good: Most months profitable
  • Warning: Alternating big wins and losses

Weekday returns:

  • Performance by day of week
  • May reveal patterns
  • Example: Strategy works better on certain days

Interpreting results

Good strategy indicators

Profitability:

  • Total return: more than 20% annually
  • Win rate: more than 50%
  • Profit factor: more than 1.5
  • Average win greater than Average loss

Risk management:

  • Maximum drawdown: less than 20%
  • Sharpe ratio: greater than 1.0
  • Consistent monthly returns
  • Smooth equity curve

Trade quality:

  • Sufficient trades (more than 20 in test period)
  • No single trade dominates results
  • Reasonable trade duration
  • Positive average profit per trade

Warning signs

Red flags:

  • Win rate: less than 40%
  • Profit factor: less than 1.0
  • Maximum drawdown: more than 30%
  • Sharpe ratio: less than 0.5

Concerning patterns:

  • Erratic equity curve
  • One trade accounts for more than 50% of profit
  • Long periods of flat performance
  • Increasing drawdowns over time

Over-optimization:

  • Perfect results (more than 90% win rate)
  • Unrealistic returns (more than 100% in short period)
  • Works only in specific date range
  • Fails when tested on different periods

Common backtest mistakes

Curve fitting

Problem: Optimizing strategy to perfectly match historical data

Example: Adjusting indicator periods until backtest shows 95% win rate

Why it's bad: Strategy won't work on new data; it's memorized the past, not learned patterns

Solution: Use simple, logical parameters; test on multiple time periods

Insufficient data

Problem: Testing on too short a period (1-2 weeks)

Example: Strategy shows 80% win rate over 2 weeks

Why it's bad: Not enough trades to be statistically significant; may be lucky

Solution: Test on at least 3-6 months; include different market conditions

Ignoring fees

Problem: Not accounting for trading costs

Example: Strategy shows 5% profit, but fees are 4%

Why it's bad: Real trading has fees; net profit may be minimal or negative

Solution: Backtest includes Hyperliquid taker fee (0.045%); verify profitability after fees

Unrealistic assumptions

Problem: Assuming perfect execution at exact signal prices

Example: Backtest uses candle close price, but real orders have slippage

Why it's bad: Real trading has delays, slippage, and partial fills

Solution: Expect 10-20% worse performance in live trading

Survivorship bias

Problem: Testing only on symbols that still exist or are popular

Example: Testing on BTC which has grown; ignoring failed projects

Why it's bad: Overestimates strategy performance

Solution: Test on multiple symbols; include range-bound and declining markets

Improving backtest results

If win rate is low (less than 40%)

Possible issues:

  • Entry conditions too loose
  • Exit conditions too tight
  • Wrong indicators for market conditions

Solutions:

  • Add confirmation indicators
  • Relax exit conditions
  • Test different timeframes
  • Consider opposite strategy (if shorting, try longing)

If profit factor is low (less than 1.2)

Possible issues:

  • Losses too large relative to wins
  • Stop loss too tight
  • Take profit too conservative

Solutions:

  • Widen stop loss
  • Increase take profit target
  • Add trend filter to avoid choppy markets
  • Improve entry timing

If maximum drawdown is high (more than 25%)

Possible issues:

  • Position sizing too aggressive
  • No stop loss or too wide
  • Trading against strong trends

Solutions:

  • Reduce leverage
  • Tighten stop loss
  • Add trend filter
  • Reduce max daily trades

If too few trades (less than 10)

Possible issues:

  • Entry conditions too strict
  • Timeframe too long
  • Test period too short

Solutions:

  • Relax entry conditions
  • Use shorter timeframe
  • Extend backtest period
  • Simplify conditions

If too many trades (more than 200)

Possible issues:

  • Entry conditions too loose
  • Timeframe too short
  • Overtrading

Solutions:

  • Add confirmation indicators
  • Increase max daily trades limit
  • Use longer timeframe
  • Strengthen entry requirements

Best practices

Test multiple periods

Don't rely on one backtest:

Bull market period:

  • Test when prices were rising
  • Example: 2023 crypto rally

Bear market period:

  • Test when prices were falling
  • Example: 2022 crypto winter

Sideways market period:

  • Test when prices were ranging
  • Example: Consolidation periods

Recent period:

  • Test last 3-6 months
  • Most relevant to current conditions

Compare to buy-and-hold

Benchmark your strategy against simply buying and holding:

If strategy return < buy-and-hold:

  • Strategy may not be worth the complexity
  • Consider passive holding instead

If strategy return > buy-and-hold:

  • Strategy adds value
  • Worth the active management

Use realistic parameters

Initial capital:

  • Match what you'll actually trade
  • Don't test with $100k if you have $1k

Leverage:

  • Start with 1x-2x
  • Only increase if comfortable with risk

Fees:

  • Backtest includes 0.045% taker fee
  • Real trading may have additional costs

Document your findings

Keep notes on:

  • Backtest parameters used
  • Results achieved
  • What worked and what didn't
  • Ideas for improvement

After backtesting

If results are good

  1. Verify on different period: Run another backtest on different dates
  2. Test on different symbol: Try same strategy on another asset
  3. Start small: Deploy with minimum budget first
  4. Monitor closely: Watch first week of live trading
  5. Compare to backtest: Track if live results match expectations

If results are poor

  1. Analyze why: Review metrics to identify issues
  2. Adjust strategy: Modify parameters or logic
  3. Backtest again: Test improvements
  4. Consider alternatives: Try different strategy type
  5. Don't force it: Some ideas don't work; that's okay

If results are mixed

  1. Identify strengths: What market conditions work best?
  2. Add filters: Limit trading to favorable conditions
  3. Reduce risk: Lower leverage or position size
  4. Partial deployment: Use smaller budget
  5. Continue testing: Iterate and improve

Next steps

Ready to deploy your backtested strategy?

  1. Deploy Strategy - Activate automated trading
  2. Monitor Performance - Track live results
  3. Overview - Review strategy builder features

Support

Need help with backtesting?