How to Optimize Trading Strategies for Robustness

Most traders who use optimization are doing it wrong. Not because they lack intelligence or effort, but because the way optimization is typically framed leads directly to over-fitting. You find the parameter combination that produced the best historical profit, congratulate yourself, and then watch that edge evaporate in live trading.

John Ehlers has a completely different view of what optimization is actually for. As a pioneer in digital signal processing applied to trading, the creator of MESA software, and the author of multiple books on technical analysis, he brings a mathematical rigour to this topic that most traders never encounter. His argument, in a nutshell: the goal of optimization is not to find the best parameters. The goal is to find the most robust parameters. Those are not the same thing, and confusing them is expensive.

This episode covers his framework for thinking about optimization as a statistical problem, the prickly pear cactus model of the parameter space, why fewer parameters is almost always better, and how often you should re-optimize based on the mathematical structure of market data itself.

Watch the full episode below, then read on for the complete breakdown.

Why “optimization” is a misnomer

John’s first point, and it is a sharp one, is that the word “optimization” is misleading. When you optimize a strategy, you are not optimizing anything in any meaningful sense. You are finding the combination of tunable parameters that produced the best historical profits. That is all.

The historical data is fixed. The best-performing parameter set from a backtest was the best for that specific data. If the trades had come out in a slightly different order, or if you had used a slightly different sample period, a different parameter set might have won. The process finds a local maximum in a specific historical sample, not a universal truth about the future.

If you have 100,000 parameter combinations and you pick the one that performed best, the probability that this exact combination will perform best in the future is roughly 1 in 100,000. That is not optimizing. That is winning a lottery and expecting to win the same one again.

The parameter space is a prickly pear, not a mound

The intuitive mental model for optimization is a smooth hill. You are trying to find the top of the hill. Nearby parameters should perform similarly. If parameter X = 14 works great and X = 15 works almost as well, you have found a robust region. That is the model most traders carry in their heads.

John’s research found this model is wrong. The actual structure of the parameter space looks more like a prickly pear cactus leaf. The high-performing parameter combinations are spikes. Narrow, sharp, hard to find, with unprofitable areas filling most of the space in between them.

This matters for robustness. A spike is fragile. If your parameters are sitting on a spike, small changes in market conditions, or even just different future trade sequences, will throw you off the spike and into the unprofitable region next door. A mound is robust. But the evidence from his work is that mounds are relatively rare in the actual parameter space, and spikes are far more common.

The implication is direct: you cannot trust the area around your best historical parameter to resemble that best historical parameter in the future. The correct response is not to find the best spike, but to reduce the number of parameters so there are fewer spikes to fall off.

The robustness metric: slope, not peak

John’s approach shifts the optimization criterion away from maximum historical profit toward something he calls the slope of the ranked results.

The idea works like this. Run your optimization and collect all the parameter combinations with their profit results. Sort them from best to worst. This gives you a curve that goes from maximum at the top to minimum at the bottom. Now look at the slope of that curve. A gentle, gradual slope means the parameter space is broad and flat. Many combinations produce similar results. A steep drop-off means the best combinations are dramatically better than the rest, which is the spike signature.

A figure of merit he uses is the 50% point. Look halfway down the ranked results curve. How far below the maximum are you? If the 50th percentile result is close to the maximum, you have a robust parameter space. If it is dramatically lower, your “best” parameters are probably a spike.

The statistical reasoning behind this is that if you are trading at the 50% point in the distribution and your strategy continues to produce trades from a similar distribution, you will tend to make at least 50% of the maximum available profit over a long future period. The law of large numbers works in your favour when you are in a broad, stable region rather than balanced on a spike.

Fewer parameters: the foundational rule for robustness

Murphy’s Law applies directly here. If you have a parameter combination that can go wrong, it will eventually go wrong in live trading. The more parameters you have, the more ways things can go wrong. Reducing the number of tunable parameters to an absolute minimum is not laziness. It is the primary mechanism for building robustness.

When you have two parameters, you can visualise the space in three dimensions: parameter X, parameter Y, and profitability in Z. You can see the hills and valleys. When you have five parameters, the space is six-dimensional and you cannot visualise it at all. John describes this as an “N-dimensional lumpy fuzzball.” You cannot find the robust mounds because you cannot even see the space clearly.

His attempted solution of integrating over areas of the parameter surface, looking for broad mounds rather than peaks, ultimately did not work. The actual structure of the space is too complex for that approach. The conclusion from this failed experiment reinforced his view that the only reliable route to robustness is to reduce parameters, not to find smarter ways to navigate a high-dimensional space.

What objective function should you optimize for?

A common question is whether to optimize for net profit, profit factor, Sharpe ratio, maximum drawdown, or some combination. John’s answer is more pragmatic than you might expect.

Net profit works about as well as anything, as long as you pair it with a check on the number of trades. This is the trap: you can generate a very high net profit by over-trading, by taking so many trades that the cumulative expectancy adds up even with a low per-trade edge. If you optimise purely for profit without constraining trade count, you can find solutions that are theoretically profitable but completely untradable in practice, requiring five or six trades per day or more.

The TradeStation fitness function and perfect profit correlation are two alternatives he found work well. But regardless of which fitness function you use, always review profit per trade alongside the total profit to make sure the solution is actually viable.

Re-optimization frequency: what market data tells you

John’s view on how often to re-optimize is grounded in signal processing theory, and it is more specific than most traders expect.

Market data is fractal, which means its spectral density has a particular structure. You can model it as white noise filtered through an exponential moving average. That exponential moving average has an alpha parameter, and from that alpha you can derive the equivalent time constant in bars. For most market data, this time constant is on the order of 100 bars, give or take.

This time constant tells you something practical. Your optimization window needs to be long enough to contain enough trades to make a statistically valid judgment, but not so long that the early data is outside the relevant time constant for the current market structure. Old data that is beyond the market’s time constant is not just irrelevant, it is actively misleading because it reflects conditions that no longer apply.

For intraday strategies trading 15-minute bars, his approach is to re-optimize daily using the last two weeks of history, then trade those parameters for the next day. For daily bars, the specifics are different but the principle is the same: match your re-optimization window to the underlying time constant of the data, not to a round number like “every quarter” or “once a year.”

Genetic optimization: how he uses it

Genetic optimization searches the parameter space more efficiently than exhaustive grid search, but it does not always show you the full picture. John’s preference is to see as many combinations as possible, so he increases the number of results saved in TradeStation from the default 200 to 2,000.

His typical setup uses about 100 samples per generation and reduces the number of generations to around 40. The combination gives him 4,000 possible tests but the genetic algorithm typically produces fewer than 2,000 unique combinations, staying within his save limit. This lets him see the full distribution of results and apply his slope-based robustness analysis rather than just looking at the top result.

The early convergence property of genetic algorithms, their tendency to find near-optimal solutions quickly before the later generations add much, is itself evidence about the distribution. When the algorithm finds a good solution fast, it tells you something about the shape of the probability distribution across parameter combinations. That early solution tends to be in a region of higher probability, even if it is not the absolute maximum.

Related episodes


Want to build trading strategies that hold up in live markets? Subscribe to the Better System Trader podcast for weekly interviews with the world’s top systematic traders and quantitative researchers.

Scroll to Top