An over-optimized EA kept losing in live trading
The failure story30s · engineer · 3 years of FX
F optimized his homemade EA on two years of data. He brute-forced five parameters, including moving-average periods, stop-loss distance and take-profit distance, about 30,000 combinations in all. The best performer was a 23 fast MA, a 117 slow MA, a 37-pip stop-loss and an 81-pip take-profit.
The backtest for that setting was stunning: a profit factor of 2.6 over two years and a 7% maximum drawdown. Convinced he had "finally nailed it," F went live on an ¥800,000 account.
Six months later the profit factor was 0.8 and the account was down to ¥640,000. When he tested the same settings on data from three years earlier, which he hadn't used for optimization, it lost there too. He also found that changing the fast MA from 23 to just 25 made the results fall apart.
* This is a model case reconstructed from common beginner mistakes, not a real person's story.
What would you do here?
You optimized your homemade EA on 2018–2023 data and found settings giving 45% a year with an 8% maximum drawdown. However, neighboring settings shifted by just 1–2 periods perform far worse. You haven't tested it on any data from 2024 onward.
Q. What do you do before going live?
Show answer and explanation
- A ◎ CorrectTest on a period not used for optimization, and check that nearby settings don't fall apart
Checking whether it holds up on unseen data (out-of-sample) and whether results stay stable when you nudge the settings tells you if it's simply fitted to the past.
- B × WrongIt's the best-performing setting, so take it live as is
The best result out of thousands of combinations most likely just happened to match past price action. On its own, that's no reason to think it will work going forward.
- C × WrongAdd more parameters and optimize further to push results higher
The more parameters you add, the more snugly it fits past data and the worse it fits future markets. You're not improving performance, just fitting harder.
- D × WrongNarrow the optimization window to 2023 alone to fit the recent market
A shorter window means fewer trades to test on, so chance plays an even bigger role. That change makes over-optimization worse, not better.
Explanation
Curve fitting means tuning parameters so tightly to past data that the system memorizes noise as if it were a "rule." Try 30,000 combinations and, however meaningless the rule, some combination will have a superb past record.
There are two ways to catch it. One is testing on a period you didn't optimize on (out-of-sample testing). The other is checking whether results hold when you shift parameters slightly. If 23 wins and 25 loses, the method is capturing luck, not something real about the market.
Keep parameters few, and only ones you can justify with reasoning. The better the results look, the more suspicious you should be. That's the basic stance of every systematic trader.
The more perfectly a setting fits the past, the worse it fits the future
Checklist before your next entry
- Have I tested on data not used for optimization?
- Do results stay stable with nearby settings?
- Have I kept parameters to the bare minimum?
Chapter 6: Scams, Easy Money and Choosing a Method — questions
- Q51Deposited into an investment app from someone met online
- Q52Handed money to a "guaranteed 10% a month" fund manager
- Q53Bought a pricey EA that only looked good in backtests
- Q54Blew up in one hit with an EA that doubled lots after every loss
- Q55Wiped out copying the No. 1 ranked trader
- Q56An over-optimized EA kept losing in live trading
- Q57Switched methods after every few losses
- Q58Signed up on the spot for a pricey "today only" FX course
- Q59Gave my account ID and password to a "manager"
- Q60Won on demo, then went big on a live account