PART VI · Chapter 52 · 306 / 660

Lesson 306. Reading out-of-sample tests and performance metrics

Chapter 52. Rule Verification, Trading Journal & Single-Stock Plan Capstone

Lesson 305's breakout rule was run several ways on 2016-2020 data. Combining the new-high period, the exit period and a market filter gave 30 variations, and among them the 55-day new-high combination was best, at an average of 0.41R per trade. Can you trust this number and put money in?

If you pick the best one of 30 and then evaluate it again on the same period, luck is mixed into that number. Lesson 476 showed why periods are split, and Lessons 465 and 478 covered maximum drawdown, win rate and compound annual growth. This lesson ties the two together into a validation plan written before seeing results and a performance table calculated from one trade list. The result is recorded as one of four verdicts.

1. Split the period in three and write the allowed changes in advance

The rules and numbers in this lesson are all hypothetical examples. Split the 2016-2025 data into three segments in time order. Lesson 476's training, validation and final test periods are called the development, selection and final test segments here.

Segment Period What is done Allowed changes
Development 2016-2020 Build candidate rules and parameter ranges Anything can change; record every attempt
Selection 2021-2022 Pick one candidate by criteria set in advance Only picking; no parameter changes
Final test 2023-2025 Run the chosen rule once No changes; run only once

The plan records two more criteria before the results are seen. For example, the selection criterion is: among candidates whose own value and those of their immediate neighbors (one neighbor for an end value) are all 0.10R or more in development, the one with the highest average R in selection. The pass criteria are of the form: at least 30 trades in the final test, an average of 0.10R or more, and a maximum drawdown of 15% or less for an account risking 1% per trade. Criteria written after the results become criteria fitted to the results.

2. Count the attempts and write them at the top of the performance table

The attempt log is a table with one line per change, segment and result. In this development segment, five new-high periods (20, 30, 40, 55 and 70 days), three exit periods (10, 15 and 20 days) and a market filter on or off were combined. That is 5 × 3 × 2 = 30 combinations, and adding the three ideas dropped along the way makes 33 attempts in all. Discarded attempts count too.

Research confirms why the number of attempts matters. In a 2014 paper in the Notices of the American Mathematical Society, Bailey and three co-authors calculated the following. With 5 years of data, testing more than 45 independent configurations almost guarantees a strategy with an in-sample annualized Sharpe ratio of 1, even though the Sharpe ratio to expect out of sample is 0. The Sharpe ratio is the return-per-unit-of-volatility measure seen in Lesson 478.

This development segment is also 5 years. The 30 configurations are similar to one another, so they are not the same as 45 independent ones, but the direction is the same. The more attempts, the larger luck's share of the best result. So write "1 of 33 attempts" at the top of the performance table.

3. Pick a value whose neighbors are even, not the best value

To keep the explanation short, look only at the 15-day exit, filter-on combination. Other combinations are screened with the same conditions. In this combination, the development-segment average R by new-high period was as follows.

New-high period Development average R Candidate condition
20 days 0.19R Met
30 days 0.22R Met
40 days 0.20R Met
55 days 0.41R Not met (neighboring 70 days is −0.05R)
70 days −0.05R Not met (own value below 0.10R)

55 days is an isolated spike. If the neighboring 70 days is −0.05R, 55 days' result was likely fitted to a few trades in those 5 years. 20, 30 and 40 days, at 0.19R to 0.22R, form an evenly good plateau, a flat high stretch. When a small change in a parameter gives a similar result, a real effect is more likely nearby.

In the selection segment, only the three candidates that met the condition are compared. 20 days is 0.12R, 30 days 0.18R and 40 days 0.16R, so 30 days is chosen. For reference, running 55 days in the selection segment collapses to 0.02R. Running the 30-day rule once, unchanged, in the final test segment gives 46 trades, an average of 0.15R, and a maximum drawdown of 11.6% for an account risking 1% per trade. 0.15 ÷ 0.18 = about 83%, so most of the selection-segment result held up in a period it had never seen.

Bar chart comparing the average R per trade of a hypothetical breakout rule split into development 2016-2020, selection 2021-2022 and final test 2023-2025. The 30-day new high in the middle of the plateau gave 0.22R in development, 0.18R in selection and 0.15R in the final test, keeping about 83% of the selection result. 55 days, the best in development at 0.41R, was an isolated spike next to 70 days at −0.05R, and collapsed to 0.02R in selection.

The single split may have been good by chance, so look once more with a walk-forward test. This check is also written into the plan in advance and is used only after the final test, never to change the rule. Choose the new-high period with only the previous 5 years of data (the highest average R among values meeting the plateau condition) and use it for the next year. Repeat this five times, from 2021 to 2025. If the chosen values are nearly the same each year, like 30, 30, 40, 30 and 30 days, and the out-of-sample average across the five years is 0.12R, that is one more piece of evidence that the plateau is real. If the chosen value jumps between 20 and 70 days each year, that in itself is a sign of instability.

4. Measure a filter's share by adding and removing it on the same data

Suppose the market filter is "enter only when the index close is above its 200-day moving average". To know what the filter actually added, keep every other condition the same and compare the two results with and without the filter in the same segment.

Development, 30 days and 15 days Trades Average R Total R
With filter 118 trades 0.22R 118 × 0.22 = 25.96R
Without filter 164 trades 0.14R 164 × 0.14 = 22.96R
Trades removed by the filter 46 trades about −0.07R 22.96 − 25.96 = −3.00R

All 118 trades with the filter are inside the 164 trades without it, so the difference between the two totals is the share of the trades the filter removed. The 46 trades removed total −3.00R, and their average is −3.00 ÷ 46 = about −0.07R. The filter took away losing trades, so it has a share. Do not judge by average R alone. An average can rise just by cutting the number of trades. Only if the trades removed by the filter total less than 0 did the filter reduce losses.

Make the same comparison in the selection segment. With the filter, 52 trades at 0.18R; without it, 60 trades at 0.15R. Then the 8 trades removed by the filter total 60 × 0.15 − 52 × 0.18 = −0.36R, the same direction. If the direction differs between the two segments, record the filter's contribution as not checked and use the simpler version.

5. Calculate trade performance and account performance separately from the same trade list

To make the calculation easy to follow by hand, shrink it to 10 hypothetical trades over two years. In R after costs, they are, in order, +3.0, −1.0, −1.0, +2.0, −1.0, −1.0, −1.0, +4.0, −1.0 and +0.5R. The stop distance is 6% of the entry price, so 1R is a 6% move in the stock.

On a trade basis, the win rate is 4 ÷ 10 = 40% and the average R is 3.5 ÷ 10 = 0.35R. The winning trades average (3.0 + 2.0 + 4.0 + 0.5) ÷ 4 = 2.375R, so 0.4 × 2.375 − 0.6 × 1.0 = 0.35R, the same as the expectancy calculation in Lesson 478. The trade return on the stock is R × 6%, so the total is 3.5 × 6 = 21%, or 2.1% per trade on average.

The account basis is a $100,000 account that holds one stock at a time and sets R0 at 1% of the account value at each entry. Then each trade changes the account by R × 1%.

100,000 × 1.03 × 0.99 × 0.99 × 1.02 × 0.99 × 0.99 × 0.99 × 1.04 × 0.99 × 1.005 = about $103,382.72

The account grew about 3.38% in two years. Converted to one year, that is the square root of 1.0338, about 1.0168 times, so the compound annual growth rate (CAGR) is about 1.68%. A rough estimate of 0.35R × 5 trades a year × 1% = 1.75% gives a similar figure. The maximum drawdown runs from the $103,000 peak after the first trade to about $99,911.01 after the seventh. That is (103,000 − 99,911.01) ÷ 103,000 = about 3.0%.

Metric Trade basis Account basis (1% risk per trade)
Win rate 40% 40%
Two-year total Sum of trade returns 21% About 3.38%
Annual performance 10% a year if the 21% is read as two-year performance CAGR about 1.68%
Largest loss Worst trade −6% Maximum drawdown about 3.0%

Reading the 21% sum of trade returns as the account's two-year performance gives the square root of 1.21, 1.1 times, which looks like 10% a year. The real account made about 1.68% a year. That is because each trade used only part of the account, and only one stock at a time.

Order changes the result too. Put the same ten trades with the four winners first and the six losers after. Only the order of multiplication changes, so the final amount and the CAGR are the same. But six losses in a row take the account down from its peak by 0.99 multiplied six times, and the maximum drawdown becomes about 5.9%. Win rate, average R and CAGR come from the trade list; maximum drawdown comes from the order.

6. Verdicts: pass, performance failure, validation failure, not checked

Verdict Meaning Next step
Pass Run as planned, and every criterion written in advance was met Move on to paper trading or live trading in small size
Performance failure The test ran properly but fell short of the criteria Drop the rule, or evaluate a revised version on new data
Validation failure The test did not run properly because of a data or method problem Leave the rule as it is, fix the problem and run again
Not checked Not enough data or trades to judge Do not count it as a pass; record what is missing

A validation failure is not the rule's report card. If you later learn that the final-test data was built from today's index members, it is a validation failure whether the result was good or bad. If the final test has only 18 trades, it is not checked, however good the average R is. No evidence is not a pass.

The 30-day rule, with 46 trades, an average of 0.15R and a maximum drawdown of 11.6%, meets all three criteria and passes for 2023-2025. But as seen in Lesson 305, the test period does not include 2008, so the performance table also records "financial-crisis-type crash: not checked".

The most dangerous moment is when a performance failure comes out. If the 30-day rule ends at 0.04R and you switch to 40 days and rerun 2023-2025, that segment becomes development data for the 34th attempt, not a test. A new version is evaluated on data not yet seen, for example by waiting until 30 paper trades have built up.

The record for this lesson is a validation plan and a performance table. The plan holds the three segments, allowed changes, selection criterion and pass criteria, with a date before the results were seen. The performance table records the number of attempts and the filter comparison, puts trade-basis and account-basis numbers in different columns, and attaches one of the four verdicts.

Try it yourself

  1. If risk per trade were raised to 2%, what would the same 10 trades give for final account value, CAGR and maximum drawdown in the original order?
  2. In the final test, the 30-day rule produced 46 trades with an average of 0.04R. What is the verdict and the next step?
  3. Testing another filter gave 40 trades averaging 0.30R with the filter and 50 trades averaging 0.26R without it. What do the trades removed by the filter total, and is there a basis for using this filter?
  4. The final test has 18 trades averaging 0.25R. What is the verdict, and what should be done?

Answers

First, 100,000 × 1.06 × 0.98 × 0.98 × 1.04 × 0.98 × 0.98 × 0.98 × 1.08 × 0.98 × 1.01 = about $106,522.36. The square root of 1.0652 is about 1.0321, so the CAGR is about 3.21%. From the $106,000 peak the account falls to about $99,648.23 after the seventh trade, so the maximum drawdown is about 6.0%. Doubling the risk nearly doubles the drawdown, but the CAGR rises less than twofold.

Second, the test ran properly and 0.04R falls short of the 0.10R pass criterion, so it is a performance failure. Do not switch to 40 days and re-evaluate the same segment. Either drop the rule, or record the revised version as the 34th attempt and evaluate it on new data.

Third, 40 × 0.30 = 12.00R and 50 × 0.26 = 13.00R, so the 10 trades removed by the filter total 13.00 − 12.00 = 1.00R. The average R rose, but the filter took away profitable trades and the total fell. This data gives no basis for using the filter.

Fourth, it falls short of the 30 trades set in advance, so it is not checked. Even if an average of 0.25R looks good, it does not count as a pass. Do not extend the same segment and choose again; put off the verdict until new data, such as paper trades, builds up.

Related lessons