Formulas and metrics

CAGR, volatility, Sharpe, Sortino, Calmar, beta, CAPM and Fama-French.

The formulas behind the backtester's metrics. They're published for transparency: knowing how a number is built is the best way to understand when it stops being reliable.

Return

CAGR (Compound Annual Growth Rate)

(VfVi) ⁣1n1\left(\frac{V_f}{V_i}\right)^{\!\frac{1}{n}} - 1

Compound annual return between starting and ending value over nn years. It says nothing about the path: two portfolios with the same CAGR can have had completely different histories.

Risk

Volatility

σmonthly×12×100\sigma_{monthly} \times \sqrt{12} \times 100

Standard deviation of monthly returns, annualised. The √12 factor assumes returns are independent from one month to the next, a convenient assumption that real markets violate precisely during crises, when declines cluster.

Drawdown

VcurrentVpeakVpeak\frac{V_{current} - V_{peak}}{V_{peak}}

The fall from a previous peak. Computed on monthly closes, so shallower than the real daily drawdown.

Risk-adjusted return

Sharpe Ratio

CAGRRfσ\frac{CAGR - R_f}{\sigma}

Excess return over the risk-free rate, per unit of volatility.

Sortino Ratio

CAGRRfσd\frac{CAGR - R_f}{\sigma_d}

Like Sharpe, but the denominator counts only downside volatility. It answers a reasonable objection to Sharpe: upside volatility isn't a risk, it's exactly what you're after.

Calmar Ratio

CAGRMaxDrawdown\frac{CAGR}{|MaxDrawdown|}

Return per unit of maximum loss. It's the metric closest to how people actually experience risk.

Market exposure

Portfolio Beta

βp=Cov(Rp,Rm)Var(Rm)\beta_p = \frac{\text{Cov}(R_p,R_m)}{\text{Var}(R_m)}

How much the portfolio moves relative to its reference market.

CAPM Expected Return

E[Rp]=Rf+βp(E[Rm]Rf)E[R_p] = R_f + \beta_p(E[R_m]-R_f)

Expected return under the Capital Asset Pricing Model, given beta.

Correlation

ρ=Cov(X,Y)σXσY\rho = \frac{\text{Cov}(X,Y)}{\sigma_X \cdot \sigma_Y}

How much two instruments move together, between −1 and +1. It's the engine of diversification: low correlation, not the number of instruments, is what reduces total volatility.

Five-factor model

Fama-French

RiRf=α+β1(RmRf)+β2SMB+β3HML+β4RMW+β5CMAR_i - R_f = \alpha + \beta_1(R_m - R_f) + \beta_2 SMB + \beta_3 HML + \beta_4 RMW + \beta_5 CMA

Decomposes a portfolio's return into exposures to market, size (SMB), value (HML), profitability (RMW) and investment policy (CMA). Backtes.to adds momentum (WML) to this multivariate regression, estimating all six betas from monthly excess returns:

RiRf=α+β1(RmRf)+β2SMB+β3HML+β4RMW+β5CMA+β6WMLR_i - R_f = \alpha + \beta_1(R_m - R_f) + \beta_2 SMB + \beta_3 HML + \beta_4 RMW + \beta_5 CMA + \beta_6 WML

Caveat. Historical factor premia are estimated over long periods and are not guaranteed going forward: some factors went through entire decades of underperformance after publication. Factor exposure describes what the portfolio is made of, it does not forecast its return. The rolling chart repeats that same regression over each trailing 60-month window; it shows how the estimated exposure has changed, not a forecast.

Graphical methods

  • Monte Carlo: thousands of simulations to estimate the distribution of possible outcomes.
  • Rolling windows: return over moving windows, to see how much the result depends on entry date.
  • FIRE simulations: accumulation and withdrawal projections; the method is described in How the FIRE simulation works.

Conventions

  • The risk-free rate RfR_f used in ratios is Euribor.
  • All metrics are computed on end-of-month monthly returns.
  • With a DCA plan active, volatility and risk-adjusted ratios use returns that neutralise contributions: see Simulating a DCA plan.