Why Daily Sharpe Ratio Calculations Can Differ from TradingView
Summary
The document asks why a manually calculated Sharpe ratio differs from the value shown by TradingView for a backtest with six trades. It provides a short series of eight daily profit observations, including both positive and negative values and several zero-return days. The author computes the ratio as the mean daily return less a daily risk-free adjustment, divided by the population standard deviation, and reports a result different from the platform’s displayed figure.
The central issue is the calculation convention: matching a Sharpe ratio requires using the same return series, risk-free-rate treatment, and standard-deviation convention as the platform. The excerpt does not include an answer, platform methodology details, or enough context to determine which convention explains the difference. It also does not clarify whether the listed values are simple returns, how inactive days are treated, or whether the displayed figure uses annualization. The example therefore frames a reconciliation problem rather than resolving it.
Key ideas
- The author compares a manually calculated Sharpe ratio with TradingView’s displayed backtest statistic.
- The manual calculation subtracts a daily risk-free adjustment from mean daily returns and divides by population standard deviation.
- Differences in return inputs, risk-free treatment, or standard-deviation convention can change a Sharpe calculation.
- The excerpt does not state TradingView’s exact methodology or identify the source of the discrepancy.
Tags
Full text
# Sharpe ratio differs from Tradingview # Sharpe ratio differs from Tradingview I tried to backtest a simple strategy on TradingView, it made 6 trades with these results: Now I want to calculate Sharpe ratio using definition provided by TradingView. So, my daily returns(`profit_by_days`) equals: ``` 2020-11-07 0.45 2020-11-08 0.00 2020-11-09 -0.14 2020-11-10 -0.05 2020-11-11 0.00 2020-11-12 0.00 2020-11-13 0.24 2020-11-14 -0.08 ``` Using this Pandas code: ``` sharpe = (profit_by_days.mean() - (2/365))/profit_by_days.std(ddof=0) ``` I get `0.257` Sharpe ratio, while TradingView shows `0.205`. Why did I get a different result?
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.