Hardly anyone reaches a strategy at the first attempt. You try an idea, it doesn't convince, you change a parameter, add a filter, drop an odd year, try again. That is the normal way of working.
Testing is not the problem. The problem is not knowing how much you have tested, because every correction that exists for that bias needs the number. This article explains what to write down, what to fix beforehand and why looking at the out-of-sample result several times spoils it.
What each extra test does
We ran an exercise on real data. We took 47 simple trend rules on the S&P 500 and tried them one at a time, in random order, on the period 1873–1948. At each step we kept the best so far. Then we looked at how that pick did in 1948–2026.
Variants tried
- What you see: lead in the period you choose on
- What you keep: lead in the following period
Source: Robert Shiller’s monthly S&P 500 series, with dividends. No risk-free rate deducted; time out of the market earns zero.
| Variants tried | Lead you see, over the median rule | Lead you keep afterwards |
|---|---|---|
| 1 | −0.01 | −0.01 |
| 3 | +0.08 | +0.04 |
| 10 | +0.14 | +0.03 |
| 47 | +0.18 | 0.00 |
The line of what you see never stops rising: with each attempt, the best result found improves a little. The line of what you keep rises at first, tops out after a few attempts and returns to zero.
The first tests add something, because they discard clearly bad rules. Beyond that, searching further only selects the rule that this particular period happened to suit. And from the inside both feel the same: in both cases the number improves.
What counts as a variant
More than it seems. These count as variants:
- every value of every parameter you tried;
- every indicator or filter you added or removed;
- every asset, universe or period you tried it on;
- every change to the entry, exit or position-sizing rules;
- every different cost or execution assumption;
- the ideas you abandoned. Those above all.
If a decision was taken after seeing a result, what was there before and what remained after are two variants.
What to write down
No tool is needed. A spreadsheet or a text file will do, with one row per test:
- Date.
- What you changed from the previous test.
- Why: the reason you had before seeing the result.
- Which data and which period you used.
- The result, good or bad.
- The version of the code that produced it.
Point 3 is the hardest and the most valuable. "Tried 14 because 20 looked bad" is an honest row, and it warns that 14 was not chosen for a reason.
If you use version control, make one commit per test and note its identifier. If you work in notebooks, keep a dated copy. What matters is being able to rebuild the list.
Freeze before looking
The log counts what you have already tried. A frozen scope stops you from carrying on testing without noticing. It means writing down, before running the test that matters, everything you will not touch afterwards.
We did this in our case RF100. Its repository includes a pre-registration document that fixes, among other things:
- the hypothesis: that the model would beat simple momentum on the same dates, holdings and costs;
- the universe of 20 stocks and the 100 input variables;
- the model and all its parameters, including the seed;
- the portfolio: the top five, equally weighted, rebalanced monthly;
- the cost levels to be tested;
- the decision rule: what had to happen for it to count as valid, and what was not enough.
That last point is what gives the rest its value. The model showed some predictive ability, but the rule required beating momentum and holding up in both halves of the period. It did not, and the verdict was NO-GO. Without the rule written beforehand, it would have been easy to present the predictive ability as a success.
The most expensive mistake: looking at the out-of-sample several times
You set aside a final period you don't touch. You finish, test it and it comes out so-so. You adjust a detail, test again and it comes out better.
At that moment the held-out period has stopped being one. You have used its result to make a decision, so it is now part of the fitting. By the third round it is as in-sample as the rest, and there is no clean data left to check anything with.
The practical rule: the held-out period is looked at once. If you change the strategy afterwards, you need new data, or you accept that the result is no longer a test and count it as one more variant.
What all this is for
The Deflated Sharpe Ratio and PBO and the multiple-testing corrections adjust a result for the number of attempts. All of them need the complete list. With an incomplete list the correction falls short and nobody can tell.
Without a log, a Sharpe of 1.5 can be the result of one idea or the best of three hundred attempts. Both cases give the same number.
Honest limits
- A log does not make a strategy good. It lets you measure how much of its result is due to the search.
- It depends on your honesty. Nobody can check from the outside that the list is complete. That is why a report must say the correction holds for the variants declared.
- What you did before you started writing things down counts too. If you cannot rebuild it, say so: "there was earlier unrecorded exploration" is useful information.
- Ideas you take from others arrive already filtered. A rule taken from an article or a course is the one that survived someone else's testing, which you don't know.
- The exercise in this article uses very similar rules on a single index. The shape of the curves is general; the specific figures are not.
Where it fits in a validation
Before running anything, our validation freezes the material received and puts the question, the tests and the agreed thresholds in writing. Selection-bias corrections are applied to the variants you declare, and the report states that it is those and no others.
These tests are part of the quantitative validation. At Strateva we validate strategies in stocks, ETFs, spot crypto and spot FX, always unleveraged and with no margin. We don't take engagements on CFDs, futures, perpetuals or options.
To ask whether yours fits, write to stan@strateva.ai with the market (stocks, ETFs, crypto or FX, spot), the frequency, roughly how many variants you tested and whether you keep a log. Don't send private code or passwords in the first email.
Educational and research content. Not investment advice. The exercise is our own calculation on Robert Shiller's monthly S&P 500 series, with dividends: 23 moving-average rules and 24 momentum rules, with the signal applied the next month, scored by their Sharpe in 1873–1948 and in 1948–2026. The curves are the exact expected value of the best rule among k chosen at random, measured as the difference from the median rule of each period. The series uses monthly averages of daily closes, which flatters all these rules. The RF100 pre-registration is in its public repository, Filip303/RF100.