Curve Fitting Nearly Ended It — Here's What Actually Fixed It

The strategy that backtested beautifully lost real money. The reason has a name, and once I knew the name, I knew what to do about it.

The strategy went live. The losses started almost immediately, and they weren't the ordinary losses a working strategy takes on its way to a profit — they were losses that never turned around. I'd tuned a backtest to look good and then handed it real money expecting the same result. It didn't repeat.

I went looking for why, and found the term for exactly what I'd done: curve fitting. If you adjust enough parameters against one fixed stretch of history, you will eventually find a combination that happened to work on that history — not because the strategy found a real pattern, but because with enough knobs to turn, something will fit almost any data by chance. I hadn't discovered an edge. I'd found the specific noise in that specific chart that my specific tweaks happened to align with. Change the data — which is what going live does, since live trading is by definition on data the backtest never saw — and the fit falls apart.

Two ideas that actually solve it

The fix, it turns out, is not a smarter indicator. It's a different relationship with your own testing process, made of two pieces:

Out-of-sample testing. Split your history in two before you touch a single parameter. Tune only on the first half. Then run the tuned strategy, completely untouched, on the second half — data it has never influenced. If it still works there, that's a real signal. If it falls apart the moment the data changes, that's curve fitting showing itself before your money finds out.

Walk-forward optimisation. Rather than one split, a moving window: optimise on a chunk of history, test on the chunk immediately after it, then slide the whole window forward and repeat. A strategy that only ever worked on one lucky stretch shows its weakness across several honest ones. A strategy that keeps holding up as the window moves is telling you something closer to the truth.

The fix for curve fitting isn't found in the strategy. It's found in how honestly you test it.

I redid the EMA crossover properly this time — tuned on one stretch, checked cold on the next, walked forward across several windows before I trusted anything. It survived. Not spectacularly — nothing about a proper walk-forward result feels as good as a curve-fitted one, and that's exactly the point. It was real.

Doing that by hand in TradingView, one window at a time, is a lot of clicking. Enough clicking that the next thing I built was a way to stop clicking. That's the next post.

Follow bots built the way this post describes

Walk-forward tested, forward-tested on paper, then run with real risk limits. 15-day free Platinum trial, no card required.