Backtest check: method and source code

The backtest check reads the CSV of a backtest you already ran and computes Sharpe, PSR, DSR, minimum track record length, skewness, kurtosis and maximum drawdown. These are conditional statistical readings. The strategy verdict stays NOT CONCLUSIVE because a CSV cannot verify the app's out-of-sample, cost, benchmark and selection prerequisites. To check a file, drop it on the app window of the home page: the figures are computed on our server, without the desktop app.

Three formats are read: returns per period, an equity curve, or trades with a date and a profit or loss. A fourth, a matrix with one column of returns per configuration tried, adds the probability of backtest overfitting. The sections below give the formula of each figure, and the code that computes them is public.

Stochastly / stochastly-calculatorsPublicThe code of this check and of the free calculators, one folder per calculation, each with its test. The backtest check is in its backtest-check folder.TypeScriptMIT licenceView the source on GitHub

To run a full backtest from Claude, Cursor or VS Code, the MCP launcher connects them to the engine of the desktop app: Stochastly/stochastly-mcp, MIT.

Public results

The public results counter could not be read just now, so no figure is shown.

How the figures are computed

The server reads the CSV cell by cell as numbers and dates. It runs no formula, macro or code from the file, and no language model produces any figure. Returns come from the file as decimals (0.01 is 1%; a value ending in % is divided by 100). An equity curve is turned into returns from one point to the next. Trades are read as profit and loss per trade; the number of trades per year is measured from the first and last dates.

SR = mean / standard deviation          (per period, biased moments)
PSR = Phi((SR - 0) * sqrt(T - 1) / sqrt(1 - skew * SR + (kurt - 1) / 4 * SR^2))
SR0 = sqrt(V) * ((1 - g) * Z(1 - 1/N) + g * Z(1 - 1/(N e)))     g = 0.5772...
DSR = PSR evaluated at SR0 in place of 0
MinTRL = 1 + (1 - skew * SR + (kurt - 1) / 4 * SR^2) * (Z(0.95) / (SR - SR0))^2

Phi is the standard normal distribution function and Z its inverse. Kurtosis is raw (3 for normal returns). V is the variance of the Sharpe ratios of your N trials. If you do not give their dispersion, the server assumes V = 1/T, the variance of a Sharpe ratio measured on T returns when the true Sharpe ratio is 0, and the computed report records that assumption. With a matrix, V is measured on its columns and N is at least the number of columns. The formulas are those of the desktop app and of the deflated Sharpe ratio calculator, checked against the app on the same series.

Sources: Bailey and Lopez de Prado (2012), The Sharpe Ratio Efficient Frontier, Journal of Risk 15(2), equations 11 and 13. Bailey and Lopez de Prado (2014), The Deflated Sharpe Ratio, Journal of Portfolio Management 40(5), equation 2.

Why N matters

When a reported series was selected as the winner from a population of tested configurations, N describes that selection population. SR0 estimates the best Sharpe ratio expected from that population under the model's no-skill assumptions. The DSR reading depends on whether the declared N and dispersion describe that selection. Adding a separate lever is not itself a reason to impose a stricter strategy verdict.

Scope of the result

The CSV report is NOT CONCLUSIVE about the strategy, whatever its DSR. The app's strategy verdict needs verified in-sample and out-of-sample observations, charged costs, an out-of-sample directional benchmark, and selection-luck evidence. A returns, equity or trades CSV cannot verify those prerequisites. With fewer than 30 observations, even the conditional statistical reading is especially fragile. DSR and MinTRL are still computed, with their assumptions; neither establishes an economic verdict on its own.

PBO, computed from a matrix

The probability of backtest overfitting needs the returns of the configurations in the declared selection population, one per column. From a single series it cannot be measured. With a matrix it is computed by CSCV with up to 16 blocks and the Sharpe ratio as the selection score. With fewer than about 100 configurations it is exploratory. The PBO calculator lists the result of each split.

Limits and privacy

Files are limited to 2 MB, 100,000 rows and 200 columns, and each address to 30 checks per 10 minutes. Dates must be written YYYY-MM-DD, with an optional time. A check is computed in memory and is not stored. Reports published before 16 October 2026 keep their public page and count in the totals above; each can be deleted with the deletion code given at publication. New reports are no longer published. Details are in the privacy policy.

The full backtest

The check reads a result you already have. The desktop app builds the backtest itself: costs per market, look-ahead guards, walk-forward validation, CSCV over every configuration it tries, and the first-passage probability of passing a prop firm challenge before breaching its drawdown limits. The app is in early access, free on one computer; join the early access, or estimate pass rates first with the prop firm challenge simulator.