Choosing Returns for Sharpe Ratio Calculation in a Backtest
Summary
The document raises a measurement question about calculating Sharpe ratios from a vectorized backtest. Its example constructs a strategy-return series by retaining bar-to-bar log returns only between an entry and an exit, while recording zero returns outside the position. The central issue is whether Sharpe ratio and annualized Sharpe should be calculated from these captured bar returns or from one aggregate return per trade.
This distinction matters because bar-based observations and trade-level observations use different sampling intervals and represent the return stream differently; annualization also depends on the observation frequency. However, the document contains only the question and example, with no answer, calculation, evidence, or recommended convention. It therefore identifies a practical backtesting issue but does not establish which return series is correct or explain how to handle overlapping trades, capital allocation, or dependence between observations. Readers would need further guidance before applying a Sharpe estimate based on either approach.
Key ideas
- The example defines strategy returns as bar-level returns captured between each entry and exit, with zeros outside positions.
- The question asks whether to compute Sharpe from captured bar returns or aggregate returns per trade.
- The two approaches use different observation intervals and represent performance differently.
- The document provides no resolution, calculation, or annualization convention.
Tags
Full text
# Compute Sharpe ratio and annualized Sharpe on captured bar returns or trade returns? # Compute Sharpe ratio and annualized Sharpe on captured bar returns or trade returns? I am currently using a vectorized backtester where I have a `strategy_returns` series which is just a version of the bar-to-bar `log_returns` series where all returns that aren't between an entry/exit pair are `0`. Below is an example illustrating what I mean: `log_returns` Series: [-0.01, 0.02, 0.01, 0.03, 0.01, -0.01, 0.02, -0.01, 0.02, 0.04] Entry/Exit Series (1 = entry, -1 = exit, 0 = none): [0, 0, 0, 1, 0, 0, 0, -1, 0, 0] `strategy_returns` Series: [0, 0, 0, 0.02, 0.01, 0.03, 0.01, 0, 0, 0] Would it be correct to use the captured bar-to-bar returns to compute SR and annualized SR instead of just assigning a single return value per trade?
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.