Deflated Sharpe ratio calculator

Compute the probabilistic Sharpe ratio, the minimum track record length and the deflated Sharpe ratio from per-period inputs. The calculation runs in your browser, and the inputs stay on your device.

Calculator

Enter each figure per period: one period is the interval of one return in the track record, such as a day or a month. The default inputs are the worked example of the DSR paper.

Track record, per period

Mean return divided by the standard deviation of returns, both over one period.

Count of returns in the track record, at least 2.

Normal returns have a skewness of 0.

Raw kurtosis: 3 for normal returns. Add 3 to an excess kurtosis.

252 or 250 for daily returns, 52 for weekly, 12 for monthly. Used for the annual figures.

Benchmark and confidence

With SR* = 0, the PSR is the probability of a positive true Sharpe ratio.

Strictly between 0.5 and 1, for example 0.95.

Trials

Count of strategy variants tried, discarded ones included, at least 1.

A short note on where N comes from, such as the size of the grid in your run log. It is printed with the results and carried by the shared link.

The variance of the per-period Sharpe ratios across your own trials. The default 0.002 is the paper's 0.5 per year at 250 periods. Left empty, V = 1/T: the dispersion of Sharpe ratios estimated on T independent returns with a true Sharpe ratio of 0.

Convert from annual figures

SR per period = annual SR / sqrt(periods per year). V per period = annual V / periods per year.

Results

Annual Sharpe ratio, SR · sqrt(periods per year)
2.5000
PSR at the benchmark SR*
0.999997
MinTRL, in observations
166.64
MinTRL, rounded up to the next observation
167
MinTRL, in years
0.67
Standard deviation of the trials' Sharpe ratios, σ(SR) = sqrt(V), per period
0.0447
σ(SR) per year, σ(SR) · sqrt(periods per year)
0.7071
SR0, the expected maximum Sharpe ratio of N trials with no skill, per period
0.1132
DSR, the PSR at the benchmark SR0
0.9004

Assumptions behind the DSR

Null dispersion V
Null dispersion from the entered V: 0.002 per period.
Number of trials
Deflated for N = 100 declared trials.
How N was counted
not stated
Version of the method
1

Link to these inputs

The link carries the numbers in the fields above, the note on N and the version of the method in its address. It holds no return series.

Sensitivity of the DSR to N

The curve holds SR, T, skewness, kurtosis and V at the values entered above and computes the DSR for N from 1 to 10,000 on a log scale, or up to the next power of ten above a larger entered N. The marked point is the entered N. The table and the CSV file carry the same points as numbers.

DSR against the number of trials N, from 1 to 10,000, log scale00.250.50.7511101001k10kNumber of trials N, log scaleDSR

With the inputs above and V = 0.002 per period, the DSR is 0.999997 at N = 1, 0.9004 at the entered N = 100 (the marked point), and 0.3389 at N = 10,000. SR0 rises with N, so the DSR falls as N grows.

DSR at selected N, with the other inputs fixed
NSR0 per periodDSR
10.00000.999997
20.02320.9999
50.05330.9986
100.07040.9939
200.08500.9816
500.10180.9462
100 (entered)0.11320.9004
2000.12370.8374
5000.13650.7314
1,0000.14560.6399
2,0000.15420.5449
5,0000.16490.4229
10,0000.17270.3389

Download the 103 points of the curve as CSV

Formulas

SR is the mean of the returns divided by their standard deviation, over one period. The annual figure multiplies it by the square root of the periods per year, which assumes returns independent from one period to the next.

SR = mean(r) / std(r)
annual SR = SR · sqrt(periods per year)

The probabilistic Sharpe ratio (PSR) is Eq. 11 of Bailey and López de Prado (2012). γ3 is the skewness of returns and γ4 their raw kurtosis.

PSR(SR*) = Φ( (SR − SR*) · sqrt(T − 1) / sqrt(1 − γ3 · SR + (γ4 − 1) / 4 · SR²) )

The minimum track record length (MinTRL) is Eq. 13 of the same paper. It gives the number of observations at which the PSR reaches the confidence level.

MinTRL = 1 + (1 − γ3 · SR + (γ4 − 1) / 4 · SR²) · (Φ⁻¹(confidence) / (SR − SR*))²

The deflated Sharpe ratio (DSR) is Eq. 2 of Bailey and López de Prado (2014): the PSR at a benchmark SR0. SR0 is the expected maximum Sharpe ratio of N independent trials with no skill, whose Sharpe ratios have variance V.

SR0 = sqrt(V) · ((1 − γ) · Φ⁻¹(1 − 1/N) + γ · Φ⁻¹(1 − 1/(N·e))),   γ ≈ 0.5772
DSR = PSR(SR0)

Here γ is the Euler-Mascheroni constant and e is Euler's number. With N = 1, no selection takes place: the calculator sets SR0 = 0, the DSR equals the PSR at SR* = 0, and the assumptions line for N reads "PSR only; no trial-count deflation."

V is an assumption about your search. Left empty, V takes the value 1/T. Under the null of the DSR each trial has a true Sharpe ratio of 0, and with independent returns the variance of a Sharpe ratio estimated on T returns approaches 1/T as T grows, for any skewness and kurtosis: the variance factor of the PSR equals 1 at SR = 0. This default leaves out any spread of true skill across trials, and the variance measured across your own trials replaces it. The assumptions under the results state which V the DSR used.

SR0 grows with sqrt(V), so the calculator prints σ(SR) = sqrt(V) next to the results, per period and per year.

Kurtosis must be at least 1 + skewness² for any distribution. A smaller value usually means an excess kurtosis entered as raw kurtosis.

Φ follows West (2005), within 1e-15 in absolute error. Φ⁻¹ follows algorithm AS 241 of Wichura (1988), within 1e-15 in relative error. Both bounds come from tests against the Python 3.12 standard library.

Worked example from the DSR paper

The example of Bailey and López de Prado (2014, pp. 9-10) is a strategy with an annual Sharpe ratio of 2.5. It is measured on 1,250 daily returns, five years at 250 a year.

Its returns have skewness −3 and kurtosis 10. It is the best of N = 100 trials, whose annual Sharpe ratios have a variance of 0.5.

SR  = 2.5 / sqrt(250) = 0.1581 per period
V   = 0.5 / 250 = 0.002, σ(SR) = 0.0447 per period (0.7071 per year)
SR0 = 0.1132 per period (1.7894 per year)
DSR = PSR(SR0) = 0.9004

The default inputs of the calculator are this example, and its DSR of 0.9004 is the value printed in the paper.

With N = 46 trials the DSR is 0.9505. From N = 47 it falls under 0.95, at 0.9494.

With normal returns (skewness 0, kurtosis 3), the DSR stays above 0.95 up to N = 88, at 0.9505. N = 89 gives 0.9498.

For MinTRL, take an annual Sharpe ratio of 2 against an annual benchmark of 1, with normal returns and 95% confidence. At 252 or 250 periods a year, MinTRL is 2.73 years.

What the DSR tells you, and what it leaves open

The DSR is the probability that the true Sharpe ratio of the strategy exceeds SR0. SR0 is the Sharpe ratio expected from the best of N trials with no skill.

The formula counts N independent trials. Correlated variants behave like fewer trials, so N is an estimate you make about your own search.

An undercounted N raises the DSR. Each variant you tried counts, including the ones discarded after a quick look.

The DSR moves with V: a larger V raises SR0 and lowers the DSR.

The inputs carry no information on transaction costs, look-ahead bias or regime changes. A backtest with a leak in its data can reach a high DSR.

The probability of backtest overfitting (PBO) measures a different quantity: how often the configuration chosen in-sample ranks under the median out-of-sample.

Frequently asked questions

What inputs does the calculator take?

Per-period figures: the Sharpe ratio, the number of observations, the skewness and raw kurtosis of returns, the benchmark SR*, the confidence level, the number of trials N and the variance V of their Sharpe ratios. A converter turns annual figures into per-period ones.

Why is the DSR lower than the PSR?

The PSR at SR* = 0 compares the Sharpe ratio with zero. The DSR compares it with SR0, which is above zero when N is 2 or more and V is positive.

What value of V should I enter?

The variance of the per-period Sharpe ratios of the trials you ran. The default of 0.002 per period is the paper's example, 0.5 per year at 250 periods, and it is an assumption to replace. With the field left empty, the calculator uses V = 1/T and prints that assumption with the results.

Does the calculator use excess kurtosis?

It takes raw kurtosis, which is 3 for normal returns. Add 3 to an excess kurtosis before entering it.

Are my inputs sent anywhere?

The calculation runs in your browser, and the calculator script makes no network request. A link made with the share button carries the inputs in its address, so opening that link sends them to stochastly.com with the request for the page.

Embed the calculator

Other sites can show the calculator in a frame served from /tools/deflated-sharpe-ratio-calculator/embed: the same fields, results, assumptions and sensitivity curve, with a visible credit and a link to the full calculator. Inputs written in the query string of the frame address, in the form of the shared link, open the frame on those inputs.

The code below places the frame and fits its height to the content. Its script applies a height message when the message comes from https://stochastly.com and from that frame, with a height from 200 to 4000 pixels, and drops any other message. The frame registers no message handler of its own, so a host page has no channel to change its inputs or its results.

<iframe id="stochastly-dsr" src="https://stochastly.com/tools/deflated-sharpe-ratio-calculator/embed" title="Deflated Sharpe ratio calculator by Stochastly" width="100%" height="900" style="border:0;max-width:720px" loading="lazy" sandbox="allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox" allow="clipboard-write"></iframe>
<script>
(function () {
  var allowed = ["https://stochastly.com"];
  window.addEventListener("message", function (e) {
    var f = document.getElementById("stochastly-dsr");
    if (!f || allowed.indexOf(e.origin) < 0 || e.source !== f.contentWindow) return;
    var d = e.data;
    if (!d || d.type !== "stochastly-dsr-height" || typeof d.height !== "number") return;
    if (!(d.height >= 200 && d.height <= 4000)) return;
    f.style.height = Math.ceil(d.height) + "px";
  });
})();
</script>

Sources

Bailey and López de Prado (2014). The Deflated Sharpe Ratio: Correcting for Selection Bias, Backtest Overfitting, and Non-Normality. Journal of Portfolio Management 40(5), 94-107. Working paper: SSRN 2460551.

Bailey and López de Prado (2012). The Sharpe Ratio Efficient Frontier. Journal of Risk 15(2), 3-44. Working paper: SSRN 1821643.

Wichura (1988). Algorithm AS 241: The Percentage Points of the Normal Distribution. Journal of the Royal Statistical Society, Series C (Applied Statistics) 37(3), 477-484.

West (2005). Better Approximations to Cumulative Normal Functions. Wilmott Magazine.

Related

Deflated Sharpe ratio, explained

Probability of backtest overfitting

Overfitting in trading

Tools