Estimating Sharpe Ratio from a Three-Period Return Sample
Summary
The document infers a sample Sharpe ratio from a simple backtest output when the risk-free rate is set to zero. Its example uses three period returns: one positive return and two zero returns. The calculation divides the sample mean by the sample standard deviation, using the sample convention with degrees-of-freedom adjustment, which reproduces the displayed ratio.
The response notes that the platform documentation requires at least three periods. This is a narrow example of reverse engineering a reported performance statistic, not a general specification of every platform setting. The result depends on the return series and the chosen standard-deviation convention; the brief explanation does not discuss annualization, return frequency, or other implementation details that could affect Sharpe ratios in broader cases.
Key ideas
- The example infers the platform’s calculation from a three-period return series.
- With the risk-free rate set to zero, the example divides mean returns by their sample standard deviation.
- The standard-deviation calculation uses a degrees-of-freedom adjustment.
- The answer cites a minimum sample length of three periods and does not establish all platform conventions.
Tags
Full text
# Figuring out how TradingView calculates the Sharpe ratio # Figuring out how TradingView calculates the Sharpe ratio This is the simplest backtest I've come up with, yet I can't figure out how TradingView has calculated the Sharpe ratio to be 0.577. I've set the risk_free_rate=0. Is it possible to extract the formula that TradingView is using from this simple example, or more data is needed? ## Answer by AKdemy (score 2) https://quant.stackexchange.com/a/75575 According to the documentation, it requires at least 3 periods. Given the output shows 1% profit you get the following in Python, ``` # define return vector ret = [0.01,0,0] # compute SR round(np.mean(ret)/np.std(ret,ddof=1),3) ``` which yields 0.577 I voted to close this question because it is off topic here. It's probably suited for money stack exchange but it is not a quantitative finance question.
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.