Backtesting guide
Deflated and Probabilistic Sharpe Ratios
The Deflated Sharpe Ratio (DSR) evaluates a selected strategy against a Sharpe benchmark raised for multiple trials. The Probabilistic Sharpe Ratio (PSR) evaluates one strategy against a benchmark chosen in advance. Both account for sampling uncertainty and non-normal returns; only DSR incorporates the search that selected the winner.
Read the practical guideKey Takeaways
- PSR addresses uncertainty around one Sharpe estimate; DSR also adjusts its benchmark for selection.
- Use non-annualized Sharpe, observation count, skewness, and ordinary kurtosis from the same return series.
- DSR also needs trial Sharpe dispersion and a defensible number of independent trials.
- Without the trial history, report the missing evidence rather than inventing a DSR.
PSR versus DSR: which question are you answering?
A Sharpe estimate of 0.12 per observation is a return-to-volatility ratio. PSR and DSR turn that estimate into conditional statistical evidence. A high PSR against zero can coexist with a much lower DSR when the strategy was selected from many alternatives.
| Method | Benchmark | Additional evidence | What remains unresolved |
|---|---|---|---|
| PSR | A declared Sharpe hurdle, such as zero | Sample length and return moments | Selection from other strategies |
| DSR | Expected maximum Sharpe under the no-skill trial model | Trial dispersion and independent trial count | Missing trials, invalid inputs, and future performance |
Calculate PSR using one return convention
Let s be the non-annualized sample Sharpe, T the number of return observations, g3 their skewness, and g4 their ordinary kurtosis. For a benchmark b in the same units, the estimated standard error is SE = sqrt((1 - g3 × s + (g4 - 1) × s² / 4) / (T - 1)). Then PSR(b) = Φ((s - b) / SE), where Φ is the standard normal cumulative distribution function.
- Construct excess returns using an explicitly chosen risk-free or reference return at the observation frequency, then estimate their mean, standard deviation, skewness, and kurtosis consistently.
- Ordinary kurtosis is 3 for normal returns. If a library returns excess kurtosis, add 3 before using this formula.
- Use non-annualized s and b. An annualized dashboard Sharpe cannot be inserted beside daily moments and a daily observation count.
- Require T > 1, positive return standard deviation, finite moments, and a positive standard-error term. A constant return series has no valid Sharpe estimate.
Replace the benchmark to calculate DSR
For the zero-mean null model in the DSR paper, let σtrial be the standard deviation of non-annualized Sharpe estimates across the trial family and N the number of independent trials. The expected maximum is approximated by bDSR = σtrial × [(1 - γ) × Φ⁻¹(1 - 1/N) + γ × Φ⁻¹(1 - 1/(N × e))]. Here γ = 0.5772156649 is the Euler-Mascheroni constant, e = 2.7182818285, and Φ⁻¹ is the standard normal quantile function. DSR = PSR(bDSR).
- σtrial measures dispersion across trial Sharpe estimates. It is not the selected strategy return volatility or its Sharpe standard error.
- This expected-maximum approximation models the distribution of trial Sharpe estimates as normal. It does not require the selected strategy returns to have zero skewness and normal kurtosis.
- The expression requires N > 1 and is an approximation, particularly for small N. For a prespecified single strategy with no selection, use PSR against the declared benchmark instead.
Worked example: one strategy, three evidence readings
Assume 252 daily excess-return observations, non-annualized s = 0.12, skewness g3 = -0.5, and ordinary kurtosis g4 = 5. For the hypothetical trial families, assume σtrial = 0.04 and independent trials. These are illustrative inputs, not measured Pineify or TradingView results. SE = sqrt((1 + 0.06 + 0.0144) / 251) = 0.06542536.
| Assumed evaluation | Benchmark b | (s - b) / SE | Result |
|---|---|---|---|
| PSR against zero | 0 | 1.8342 | 96.67% |
| DSR, N = 20 | 0.07602832 | 0.6721 | 74.92% |
| DSR, N = 100 | 0.10122412 | 0.2870 | 61.29% |
- For N = 20, Φ⁻¹(0.95) = 1.64485 and Φ⁻¹(1 - 1/(20 × e)) = 2.08811. Multiplying their weighted sum by 0.04 gives bDSR = 0.07602832.
- At a prespecified 95% threshold, PSR against zero clears the hurdle in this example, while both DSR scenarios fall below it. That threshold is a decision rule, not a guarantee of investment quality.
- Keeping all other inputs fixed but assuming normal moments (g3 = 0, g4 = 3) raises PSR against zero to 97.09%. Replacing observed moments with normal values changes the answer.
- The two DSR rows are sensitivity scenarios. They do not justify choosing the smaller trial count because it produces a higher probability.
Keep a trial ledger before selecting the winner
The saved winning strategy cannot reconstruct its own selection history. Keep every evaluated candidate that influenced the decision, including discarded parameters, filters, instruments, timeframes, and sample windows. A run that fails before producing returns belongs in the audit log with its reason; it cannot supply a fabricated Sharpe value.
| Record | Minimum fields | Purpose |
|---|---|---|
| Candidate identity | Run ID, code revision, parameters, symbol, timeframe, dates | Reconstruct the search family |
| Comparable results | Return frequency, reference return, costs, Sharpe, return-series location | Estimate dispersion without changing conventions |
| Selection process | Timestamp, selection metric, retained or discarded status, failures | Preserve unsuccessful research choices |
| Dependence estimate | Raw candidate count M, aligned returns, method, effective N, sensitivity range | Distinguish many similar variants from independent trials |
| Selected-series inputs | T, s, skewness, ordinary kurtosis, missing-data policy | Reproduce the PSR standard error |
Treat trial correlation and return dependence separately
Correlation across candidate strategies concerns the effective trial count N. Serial dependence within the selected return series concerns the uncertainty of its Sharpe estimate. Reducing N for correlated variants does not solve serial dependence, overlapping trades, or stale prices in the selected series.
- Store the raw candidate count M as well as the estimated N. Document the correlation or clustering method and alignment period; similar parameter settings alone do not quantify dependence.
- The DSR paper discusses average-correlation approximations and their limits: correlation measures only linear dependence, and a large candidate set with short history can produce unstable estimates.
- If the trial ledger is incomplete, label DSR unavailable. A sensitivity table with explicitly assumed trial counts can show the consequences, but it is not an estimated correction for the actual search.
- Short samples make skewness and kurtosis unstable. Strong serial dependence, nonstationarity, infinite moments, or inconsistent sampling can invalidate a naive normal-approximation probability.
Audit a TradingView export before using its Sharpe
A TradingView List of Trades CSV contains trade records; those rows are not automatically a daily marked-to-market return series. Pineify Backtest Deep Report parses the trade export and reports trade-based return and risk metrics. Its current Sharpe calculation uses per-trade percentage returns and an annualization factor based on trades per year. It is therefore not the daily s used in the example above.
- Use the report to inspect trades, P&L, drawdown, and standard Sharpe. Its distribution calculation reports excess kurtosis; add 3 only when using that value with the same trade-return series in a PSR formula. Retain the original export and document costs and capital assumptions.
- For a daily PSR or DSR study, prepare a consistently sampled equity-return series, including the intended treatment of open positions and inactive periods. Do not substitute closed-trade percentages without redefining the analysis.
- Compute PSR and DSR separately from the disclosed inputs and trial ledger. Backtest Deep Report has no built-in PSR, DSR, or effective-trial estimator.
- The Pine Script AI Coding Agent can help draft a custom return or statistics script when that is needed. Review and validate its output; it cannot recover unrecorded trials or establish independence from the winning script.
Related Pineify workflow
Inspect the backtest inputs before a separate PSR or DSR calculation
Import a TradingView trade CSV into Backtest Deep Report to review the selected strategy trade records and risk metrics. Keep the trial ledger and consistently sampled returns alongside that report.
Inspect trade records, P&L, drawdown, and standard Sharpe from the CSV.
Review the selected backtestDraft a custom return or statistics script for review when the research needs one.
Prepare a custom scriptBoundary: Pineify does not provide a built-in PSR or DSR calculation. A report or generated script cannot reconstruct missing trials or validate the statistical assumptions for you.
Primary sources
- Bailey and Lopez de Prado, The Deflated Sharpe RatioVerified 2026-10-17
- Bailey and Lopez de Prado, The Sharpe Ratio Efficient FrontierVerified 2026-10-17
This page is educational and does not provide investment advice. Backtests are hypothetical, depend on their data and assumptions, and do not guarantee future results. Trading can result in substantial loss.