Validation: how far can you trust a result?
The validation report: how many variants you tried, the Sharpe ratio corrected for them, walk-forward, Monte Carlo, buy-and-hold and a sealed hold-out.
What it tells you
A good backtest is easy to find if you try enough things. Change a period, an instrument, a filter, sweep a grid of values: sooner or later one version looks excellent by luck alone. The validation report puts next to a result the numbers that say how much of it may be that luck:
- how many variants this idea has tried, and how many of them were really different;
- the deflated Sharpe ratio: the run's Sharpe ratio measured against the best one luck alone would be expected to produce after that many tries;
- the walk-forward, the Monte Carlo trade shuffle and the run's neighbours in its sweep;
- a buy-and-hold comparison with the instruments it traded;
- the sealed hold-out: a stretch of history kept out of every run until you test on it once.
Every number comes with a sentence that says how to read it. The report gives no verdict: there is no pass or fail and no threshold. What is good enough is your decision.
You find it on a strategy's Validation tab, and your connected AI app reads the same report (Connect your AI).
The strategy and its copies
The report covers a strategy and every copy made from it with Duplicate, and the copies of those copies. Variants you try on a copy count for the original, and a hold-out sealed on any of them covers all of them: a copy is not a way around the count or the seal. A copy shows "copied from" with its source's name.
A strategy you create from pasted text, or that your AI app creates from text, starts a count of its own, even when the text is a copy of another strategy. To keep the count, duplicate.
Counting starts when the platform first records a run of the strategy; runs completed before that are not counted. The report shows the date counting began.
Variants tried and independent tries
Every backtest, every combination of a sweep and every run of a walk-forward that completes is recorded in the strategy's ledger, and stays there when you delete the run, the sweep, the walk-forward or the strategy itself. A failed or cancelled run is not recorded.
Identical re-runs count once. Two runs are the same variant when the engine was asked the same question: the same rules (the name, the description and the comments do not count), the same period, mode, starting balance, leverage, account currency, slippage and broker costs. Running a sweep's combination as a full backtest is therefore not a new variant.
Independent tries. Variants that trade almost the same trades are not separate ideas: a moving average of 14 and one of 15 make nearly the same profits and losses on the same days. The report groups the variants whose daily returns move together, and counts each group once:
- two runs, or two groups, join when the correlation of their daily returns is 0.5 or more on average (the line is fixed: you cannot move it);
- runs are compared on the days both traded; two runs that share fewer than 60 days of returns, such as runs over different periods, count separately;
- a sweep's combinations are grouped among themselves first, then the groups and the other runs are grouped across the strategy and its copies;
- runs that never traded form one group of their own.
The report shows both counts, for example "1,000 variants tried, behaving like 23 independent tries", with the size of each group.
The deflated Sharpe ratio
The more independent tries you make, the higher the best Sharpe ratio luck alone would produce. The deflated Sharpe ratio, from David Bailey and Marcos López de Prado (2014), measures your run against that bar:
- The expected best Sharpe from luck: what the best of that many independent tries would reach if none of them had an edge, given how spread out the groups' Sharpe ratios are.
- The probability: how likely it is that your run's Sharpe ratio is above that bar. It takes into account how many daily returns the run has, and whether they are skewed or have fat tails (a few very large days), which make a Sharpe ratio less reliable.
Read it as a probability, not a grade. A high probability says the result is unlikely to be luck alone, given what you tried; a low one says a result this good is what so many tries would be expected to turn up anyway.
It cannot be computed in a few cases, and the report says why: a run completed before the platform kept its daily returns (rerun it: the rerun is the same variant), a Sharpe ratio that is undefined, or fewer than two groups with a Sharpe ratio, so the spread of the tries is unknown. With every variant in one group, the run is measured against a Sharpe ratio of zero. A run with fewer than 30 daily returns is shown with a note.
How it worksMetrics, definedHow the Sharpe ratio itself is computedWalk-forward, Monte Carlo and neighbours
- Walk-forward: the strategy's latest completed walk-forward, with its out-of-sample net profit, profitable folds and walk-forward efficiency (Walk-forward).
- Monte Carlo: the run's trades reordered at random. The report shows the drawdown that 1 in 20 orders exceeds, the share of orders that end in profit, and where the real drawdown ranks among them (Monte Carlo).
- Neighbours: when the run is a combination of a sweep you still have, its neighbours one step either way on each parameter, and what they made compared with it. Neighbours that made close to the same profit mean a plateau; neighbours far below it mean an isolated spike.
Buy-and-hold
Would simply holding the instrument have done as well? The report draws the strategy's equity and the price of each instrument it traded on one chart, both as a percentage of where they started, so a small account and a large index compare. Instruments the strategy only read, without trading them, are left out.
- The instrument's line is its own price move in its own currency, with no costs and no financing. The strategy's line is its equity after all its costs.
- Both lines are read at the same moments: the start of the period, the first moment of each later day, and the end.
- Beside the chart: the time in the market, and the share of the period with a long position and with a short one (a hedged account can hold both at once, so the two can add up to more than the time in the market).
The same figures are on the backtest report. A run completed before they were recorded shows them once you rerun it.
The sealed hold-out
A hold-out is history you keep for one final test. The platform enforces it: once you seal a date, no run of the strategy or its copies may read data from that date on. A backtest, a rerun, a sweep, a walk-forward or a full backtest of a sweep result that reaches the date is refused, with the date and the ways out. The run dialogs stop their end date before it.
- Seal a date at or after the last date any run of the strategy and its copies has already read: a seal over data you have already seen would not be a hold-out. The Validation tab shows the earliest date you can seal. One seal stands at a time, and a template cannot be sealed: duplicate it and seal the copy.
- Run the hold-out once. The hold-out run is a backtest from the seal date to the end of the data (or a date you choose), with your settings. It shows only its progress while it runs, and its figures only when it completes. If it fails or you cancel it, the seal is handed back as it was and the run is deleted, unseen: you can run it again.
- After the hold-out run completes, the period is ordinary history again: later runs into it are counted like any other, and the report keeps the hold-out run's figures beside your development runs. You can seal a later date, on data nothing has read.
- Unseal without running the hold-out if you must. It is permanent, you can give a reason, and the report shows it with the number of runs that read the period afterwards. While the hold-out run is in progress, cancel it first.
With your AI app
A connected AI app reads the report and the ledger, seals a hold-out, and runs or unseals it: running and unsealing show you a preview first and act only when you approve. It cannot compute these numbers itself; it reads the platform's.
Questions?support@algotradinghub.io