Interpreting Backtest Results

Learn how to analyze backtest results and make informed decisions about your trading strategies.

Results Overview

When a backtest completes, you'll see:

  1. Summary Card - Key metrics at a glance
  2. Equity Curve - Visual performance over time with per-candle drawdown tracking
  3. Trade List - Individual trade details with entry/exit markers
  4. Statistics Panel - Comprehensive metrics
  5. Diagnostic Output - Strategy debug logs (if enabled)

Key Performance Metrics

Return Metrics

MetricFormulaInterpretation
Total Return(Final - Initial) / Initial x 100Overall profit/loss %
Annualized ReturnTotal Return x (365 / Days)Yearly equivalent
Monthly ReturnAverage return per monthConsistency measure
Initial Balance: $10,000
Final Balance: $12,500
Total Return: ($12,500 - $10,000) / $10,000 = 25%

Risk Metrics

MetricDescriptionTarget
Max DrawdownLargest peak-to-trough decline< 20%
Average DrawdownMean of all drawdowns< 10%
Recovery TimeTime to recover from drawdownShorter is better

The equity curve now includes per-candle drawdown tracking — at each candle, the current drawdown from peak equity is recorded, giving you a continuous view of underwater periods.

Trade Statistics

MetricDescriptionGood Value
Total TradesNumber of completed tradesStrategy-dependent
Win RateWinning trades / Total trades> 50%
Average WinMean profit on winning trades> Average Loss
Average LossMean loss on losing trades< Average Win
Largest WinBest single tradeReasonable
Largest LossWorst single trade< 5% of capital

Risk-Adjusted Returns

Profit Factor

Profit Factor = Gross Profit / Gross Loss

Example:
Gross Profit: $5,000
Gross Loss: $2,500
Profit Factor: $5,000 / $2,500 = 2.0
ValueInterpretation
< 1.0Losing strategy
1.0 - 1.5Marginal
1.5 - 2.0Good
> 2.0Excellent

Sharpe Ratio

Measures return per unit of total risk:

Sharpe = (Return - Risk-Free Rate) / Standard Deviation
ValueInterpretation
< 0Worse than risk-free
0 - 1.0Suboptimal
1.0 - 2.0Good
> 2.0Excellent

Sortino Ratio

Like Sharpe, but only penalizes downside volatility:

Sortino = (Return - Risk-Free Rate) / Downside Deviation
ValueInterpretation
< 1.0Poor
1.0 - 2.0Acceptable
2.0 - 3.0Good
> 3.0Excellent

Tip: Sortino is often more useful than Sharpe for trading strategies, as it doesn't penalize upside volatility.

Exit Reason Codes

Each trade in the results includes an exit reason. Understanding these helps diagnose strategy behavior:

CodeDescriptionMeaning
SLStop LossPrice hit the stop loss level
TPTake ProfitPrice hit the take profit target
trailingTrailing StopTrailing stop was triggered
strategy_closeStrategy CloseStrategy signaled to close the position
dcaDCA EntryDollar-cost averaging added to position
flipPosition FlipStrategy flipped from long to short or vice versa
end_of_testEnd of TestPosition was open when backtest period ended
partialPartial CloseStrategy closed part of the position

DCA Trade Handling

When a strategy uses Dollar-Cost Averaging (DCA), trades are handled specially:

  • DCA entries appear as separate trade records linked to the parent position
  • Average entry price is recalculated after each DCA entry
  • Position size accumulates across DCA entries
  • Final PnL is calculated against the weighted average entry price
  • Exit reason on DCA entries shows dca — the parent trade shows the actual exit reason

Diagnostic Output

Strategies can emit diagnostic output using td.log() or td.debug(). When enabled:

  • Log messages appear in a collapsible panel below the trade list
  • Each log entry includes the candle timestamp and message
  • Useful for understanding why a strategy entered or exited a trade
  • Enable via the "Show Diagnostics" toggle in backtest settings

Equity Curve Analysis

What to Look For

PatternMeaningAction
Steady UptrendConsistent profitsGood sign
Volatile SwingsInconsistent performanceReview risk management
Flat PeriodsNo trades or break-evenCheck entry criteria
Sharp DropsLarge lossesInvestigate specific trades
Stair-Step UpWinning streaksSustainable if frequent

Red Flags

Warning SignPossible Issue
Single large spikeOne lucky trade skewing results
Steady declineFundamentally flawed strategy
Long flat periodsStrategy may be inactive
Recovery never happensMax drawdown too severe

Trade Analysis

Individual Trade Review

For each trade, examine:

FieldPurpose
Entry TimeWhen position opened
Exit TimeWhen position closed
Entry PriceOpening price
Exit PriceClosing price
SizePosition size
PnLProfit or loss
PnL %Percentage return
DurationHow long held
Exit ReasonSL, TP, trailing, strategy close, etc.

Identifying Patterns

Look for:

  • Clusters of losses - What market conditions?
  • Big winners - Can you replicate the setup?
  • Quick exits - Are stops too tight?
  • Long holds - Strategy holding losers?
  • DCA chains - Are DCA entries improving average price effectively?

Comparing Backtests

Side-by-Side Comparison (Whale Tier)

The built-in comparison tool lets you overlay multiple backtest results. Compare equity curves, metrics, and trade distributions across different parameter sets or strategies.

MetricBacktest ABacktest BBetter
Total Return45%38%A
Max Drawdown25%12%B
Win Rate52%61%B
Profit Factor1.82.1B
Sortino1.52.3B

What Matters Most?

Prioritize based on your goals:

GoalKey Metrics
Maximum GrowthTotal Return, Monthly Return
Capital PreservationMax Drawdown, Win Rate
ConsistencySortino, Profit Factor
ScalabilityTrade Count, Avg Trade Size

Making Decisions

When to Use a Strategy

The backtest results suggest the strategy is viable when:

  • Positive total return across multiple periods
  • Max drawdown within your tolerance (typically < 20%)
  • Win rate above 45% with favorable R:R
  • Profit factor above 1.5
  • Sortino ratio above 1.5
  • Sufficient trade count for statistical significance (50+)

When to Reject a Strategy

Consider rejecting if:

  • Total return is negative
  • Max drawdown exceeds 30%
  • Win rate below 40% without high R:R
  • Profit factor below 1.2
  • Results depend on a few outlier trades
  • Performance varies wildly across periods

When to Optimize Further

The strategy shows promise but needs work when:

  • Good return but high drawdown → Improve risk management
  • High win rate but low return → Improve take profits
  • Low win rate but positive → Check stop losses
  • Inconsistent performance → Review entry criteria

Next Steps