How Backtests Calculate Sharpe Ratio, Drawdown, and Returns
Summary
The article explains a backtest performance function that turns starting capital, cumulative profit observations, timestamps, and annual trading days into total and annualized returns, Sharpe ratio, volatility, maximum drawdown, and win rate. It walks through the function’s inputs and outputs, then describes how the calculations use the profit series.
Returns are grouped into daily buckets to estimate annualized volatility from the standard deviation of annualized period returns. Sharpe is calculated as annualized return minus a fixed risk-free rate, divided by volatility. Maximum drawdown tracks the decline from the highest recorded account value, while the win rate counts positive profit increments. A small numerical example illustrates variance and standard deviation. The method is tied to the platform’s implementation: it forces a daily period and uses a fixed risk-free assumption, so results depend on these conventions and on the quality and frequency of the supplied profit data.
Key ideas
- The function derives several performance measures from a chronological series of cumulative profits and a starting account value.
- It groups profit changes into daily buckets before estimating annualized volatility.
- The Sharpe ratio subtracts a fixed risk-free rate from annualized returns and divides by volatility.
- Maximum drawdown is measured from the largest account value reached to a later lower value.
- The win rate counts profit observations that exceed the preceding observation.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.