algobacktesting

Probability of Backtest Overfitting

The Probability of Backtest Overfitting (PBO) asks one question about a search: when you pick the version that did best on the past, how often does it turn out to be no better than the middle of the pack on data it was not picked on? It was published by Bailey, Borwein, López de Prado and Zhu.

How it is measured

  1. Put every version you tested in a table: one row per day, one column per version, each cell that day's result.
  2. Cut the days, in order, into an even number of equal blocks, such as 16.
  3. Take every way of choosing half of the blocks. With 16 blocks there are 12,870.
  4. In each, find the best version on the chosen half, then see where it ranks on the other half.
  5. PBO is the share of splits in which that version ranked no better than the middle.

The method is called combinatorially symmetric cross-validation (CSCV). Both halves are the same size, and every block is used on both sides.

What the number means

Versions with no real difference between them give about 50%. Low is good: near 0%, the version that wins in one half keeps winning in the other. On a small number of versions, or few days, the result swings a lot, so one low number is not proof.

Three searches from this project's own demonstration, each over 200 strategies and about four years of daily returns (1,008 days):

What was in the searchBest annual SharpePBO
200 strategies, no edge1.6927.5%
one modest real edge added1.6927.4%
one strong real edge added2.228.2%

The first two searches gave the same winner: a strategy made of noise, with a Sharpe ratio of 1.69. The modest real edge was in the second search, and the search did not find it.

Run it on your own versions

The strategy builder on this site tests a rule you write in plain words on your own price bars. Once you've tested two or more versions it shows their PBO, worked out in your browser.

Open the strategy builder

In Python, with one column per version:

pip install algobacktesting

from algobacktesting import probability_of_backtest_overfitting

result = probability_of_backtest_overfitting(daily_results, n_partitions=16)
result.pbo

What it cannot tell you

Source: Bailey, Borwein, López de Prado and Zhu, The Probability of Backtest Overfitting, SSRN 2326253.