Backtesting

Understanding Key Backtesting Metrics (Sharpe, Drawdown, Profit Factor)

A practical deep dive into the Sharpe ratio, maximum drawdown and profit factor: how each is calculated, what values are realistic, how they mislead, and how to use them together.

By AlgoXP4 min readUpdated

Equity curve with the drawdown chart below and the maximum drawdown marked

Three numbers appear in almost every discussion of a trading system: the Sharpe ratio, the maximum drawdown and the profit factor. Each captures something real, each can be gamed, and together they give a far better picture than any one of them. This article explains how to calculate and read them.

Sharpe ratio: return per unit of volatility

Definition. The Sharpe ratio is the average excess return divided by the standard deviation of those returns:

Sharpe = mean(R − Rf) / stdev(R − Rf)

where R are periodic returns (usually daily) and Rf is the risk-free rate. William Sharpe’s 1994 article generalised the original measure to any differential return against a benchmark.

Annualising. A Sharpe ratio computed on daily returns is converted to an annual figure by multiplying by the square root of the number of trading periods: about √252 for daily data. Always compare Sharpe ratios computed on the same frequency.

Example. A strategy averages 0.06% per day with a daily standard deviation of 0.8%. Ignoring the risk-free rate:

0.0006 / 0.008 × √252 ≈ 1.19

What it captures. How smooth the returns are relative to their size. A strategy that earns steadily with small swings has a high Sharpe; one that earns the same in violent jumps has a low one.

How it misleads.

  • It treats upside volatility as risk. A strategy with occasional huge winners is penalised. The Sortino ratio, which uses only downside deviation, is often a better fit for trend-following systems.
  • It assumes returns are roughly normal. Grid and martingale strategies produce many small gains and rare catastrophic losses. Until the catastrophe appears in the test period, their Sharpe looks excellent.
  • Per-trade Sharpe is not the same metric. Some reports compute a ratio on trade results rather than on time-based returns. It is useful for ranking, but not comparable with fund or index Sharpe ratios.

Maximum drawdown: the worst fall you had to sit through

Definition. The largest decline from an equity peak to a subsequent trough, usually in percent:

Max DD = max over time of (Peak equity − Current equity) / Peak equity

Equity vs balance. Balance drawdown only counts closed trades. Equity drawdown includes floating losses while positions are open. For a strategy that holds a losing grid for days, balance drawdown can look tiny while equity drawdown was close to a margin call. Always look at equity drawdown.

What it captures. The pain you must survive without abandoning the strategy, and the capital buffer you need.

How it misleads.

  • It is one number from one path. Reshuffle the same trades in a different order and the drawdown changes. A Monte Carlo test with a few thousand reshuffles typically shows a 95th-percentile drawdown well above the historical one. Plan for that number, not the backtest’s.
  • It ignores duration. Add time to recovery: how long equity stayed below its previous high.
  • It scales with position size. Halve the risk per trade and the percentage drawdown roughly halves. Compare strategies at equal risk per trade.

Rule of thumb. If the maximum equity drawdown in the backtest is X, set your mental and financial limit at 1.5-2 × X. If that number is unacceptable, reduce position size before going live.

Profit factor: gross profit per unit of gross loss

Definition.

Profit factor = Gross profit / Gross loss

A value of 1.0 is breakeven; 1.5 means the strategy made 1.5 units for every unit lost.

What it captures. The overall balance of wins and losses, independent of position sizing. It is intuitive and hard to distort with one parameter.

How it misleads.

  • Small samples. With 15 trades, two lucky winners can produce a profit factor of 4. With 400 trades the same strategy might settle at 1.3.
  • It ignores order. Twenty losses in a row and twenty losses spread evenly give the same profit factor and very different drawdowns.
  • Costs. Profit factor drops sharply when realistic spread and commission are added to short-term strategies. Always quote it after costs.

Realistic values. For a strategy with hundreds of trades after costs, 1.2-1.5 can be tradable, 1.5-2.0 is strong, and values much higher deserve a search for the mistake.

Using the three together

The metrics answer different questions:

Metric Question Blind spot
Sharpe How smooth is the return? Tail risk, upside volatility
Max drawdown How bad did it get? Only one path; duration
Profit factor How much is won per unit lost? Order of trades; sample size

A strategy worth further testing usually shows all three in a reasonable range at once, on a large sample, after costs, and keeps them on out-of-sample data. Typical warning combinations:

  • High Sharpe, high profit factor, few trades - probably overfitted.
  • High Sharpe, tiny balance drawdown, large equity drawdown - losses are being held open (grid or averaging).
  • Good profit factor, very long drawdown periods - the edge exists but comes in rare bursts; check whether you could follow it.

As optimisation criteria

Optimisers rank parameter sets by a fitness value. If you rank by a single metric, the optimiser finds the settings that maximise that metric on this particular history - including its luck. Combining criteria (for example, maximise profit factor, minimise equity drawdown, require a minimum number of trades) produces more balanced results. cTrader lets you combine several standard criteria or write your own fitness function; see what strategy optimisation is.

Key takeaways

  • Sharpe measures smoothness, drawdown measures pain, profit factor measures balance of wins and losses.
  • Each has a blind spot; read them together and always after costs.
  • Treat the backtest’s maximum drawdown as a minimum estimate of future drawdown.
  • Spectacular values on a small sample are a warning, not a result.

FAQ

What Sharpe ratio is realistic for a retail trading bot?

On annualised daily returns, a Sharpe ratio between about 0.7 and 1.5 after costs is already good for a single strategy. Backtests above 3 are usually a sign of overfitting, missing costs or hidden tail risk such as martingale sizing.

Why is my live drawdown bigger than the backtest's?

The backtest's maximum drawdown is one observation from one historical path. Future paths can contain longer losing streaks. Monte Carlo reshuffling of trades usually shows that a drawdown 1.5-2 times the backtest value is entirely plausible.

Should I optimise for profit factor?

It is a reasonable criterion when combined with a minimum number of trades and a drawdown limit. On its own, optimisation tends to find settings with very few, very lucky trades and a spectacular profit factor.

Sources and further reading

  1. William F. Sharpe: The Sharpe Ratio (1994) - web.stanford.edu
  2. cTrader Help: Optimise a cBot (criteria and fitness) - help.ctrader.com
  3. Bailey et al.: The Probability of Backtest Overfitting - papers.ssrn.com