Skip to content

What the optimizer actually does

The optimizer runs a loop, over and over, on one strategy:

  1. Backtest the current version of the rule.
  2. Show the AI the rule and how it did, and ask it to write a better one.
  3. Check the new rule is valid code that does something sensible.
  4. Backtest the new version.
  5. Keep it only if it’s genuinely better. Otherwise throw it away and try again.

Every version it keeps is saved, so you can see what changed and go back.

The part that matters most

Step 5 is where the whole thing lives or dies, because “better” is very easy to fake. A rule tuned until it fits the test data perfectly will always look better on that data — that’s overfitting, and a naive optimizer is a machine for producing it at speed.

So the backtest is split. The rule is tuned against one stretch of history (in-sample) and then scored on a different stretch it was never tuned against (out-of-sample). A candidate that improves on the first and falls apart on the second is rejected, however good the headline number looks.

It also remembers. Candidates that have already been tried and rejected are kept between runs, so it doesn’t spend your afternoon rediscovering the same bad idea from three sessions ago.

It reads what happened in real trading too

A backtest only knows what the rule would have done. The daily trade reviews know what it actually did, and why it hurt. So before it starts, the optimizer is given what the last two weeks of reviews said about this strategy. That covers the problems they found, the changes they suggested, and the trades they graded poorly.

Say the reviews keep noting that three of every four stop-outs recovered by the close, and suggest a wider stop. The optimizer is pointed at that problem first. It treats the suggestion as an idea to test rather than an instruction, though. A wider stop still has to beat the current rule on history it wasn’t tuned on, or it’s thrown away like anything else.

What it is not

It is not a machine that finds you a profitable strategy. It’s a machine that explores variations of a rule you already had, and rejects most of them. If the original idea has no edge, no amount of rewriting will manufacture one — it will just find increasingly elaborate ways of describing the past.

It also can’t know anything the backtest doesn’t. It sees historical prices. It doesn’t see the news, your risk tolerance, or the fact that the market changed character in 2022.

How to use it sensibly

Treat an accepted version as a candidate, not an answer. It has cleared a reasonable statistical bar and nothing more. Put it on paper alongside the version you’re already running and let a few weeks decide between them.

The optimizer is very good at generating things worth testing. It is not a substitute for testing them.