A tale where the conclusion completely reversed due to 2 bugs in the verification code — common checkpoints that are easy to overlook when creating your own EA
“Tighter stops yield better results” — this was a trend I long believed during testing of my own EA. In thousands of backtests, narrowing the stop seemed to increase win rate and expected value. Yet the moment I fixed a single line in the validation code, the trend flipped completely to the opposite.
In short,“Tighter stops yield better results” is false. After fixing the bug, the trend completely reversed: wider stops tended to increase expected value. Moreover, this bug was not just one issue but two that ran simultaneously, and the correct trend wasn’t visible until both were fixed. Knowing these two bugs ahead of wasting hundreds of hours on self-made EA validation will be hugely beneficial.
Apologies for the delay,my name is Lulu.fx. I am an active discretionary trader focused on GOLD (XAUUSD) and am currently challenging a prop firm (Company A).
In the past six months, I have tested over 47,000 EA configurations with AI assistance, and the two validation bugs I found during the process are serious enough to require rechecking conclusions across all projects.
In this article, I will write with actual t-values and numbers about: ① what kind of bugs they were, ② why they created the false trend “tighter stops are better,” and ③ three checkpoints to avoid the same traps in your own EA development— useful for anyone building or about to start building EAs.
? Table of contents
▼ Free release
- Until the moment the validation bug was found
- The instant the bug was found and it became clear that “tighter stops are better” was false
▼ Read more to reveal
Until the moment the validation bug was found
The trigger was when validating a new EA. In the backtest, I encountered an unbelievable valuet-value +112— an impossibly high figure by normal standards.
The t-value measures statistical significance; above +3 is typically significant, above +10 raises suspicion.+112 is at a level where you should suspect a bug.
“Anomalously good numbers” should be approached with skepticism
A typical EA tester might rejoice at such numbers, thinking, “I found a winning EA!”
But with developed statistical intuition, you switch to a caution mode.“Numbers look too good” = “there is a bug somewhere in the validation code”is the guideline in this field.
Tracing the validation code line by line showed two bugs running simultaneously. Moreover, both bugs interacted in a negative way, aligning to “inflate results in the same direction.”an adverse coupling that made results misleadingly favorable.
The horror of instantly doubting thousands of hours of validation results
The instant a bug was found, my first thought was, “Do I have to redo thousands of hours of validation results up to now?”
Because the same validation harness had been used across all projects (EURUSD, GOLD, distributed books, etc.), the bug affected them all.
Ultimately, after rechecking every project, fortunatelythe majority of the negative conclusions remained valid(since bugs tend to push results upward rather than downward, a negative conclusion wouldn’t flip to positive). The cold sweat at that moment, though, is unforgettable.
The moment when fixing the bug proved that “tighter stops are better” was false
After fixing the bugs and revalidating the same EA, the performance trendcompletely reversed. The most striking change was in the systematic effect of stop width.
Trend before the fix (false)
- Stop 1.0×ATR: EV +0.09, win rate 68%
- Stop 1.5×ATR: EV +0.06, win rate 61%
- Stop 2.0×ATR: EV +0.03, win rate 55%
- Stop 3.0×ATR: EV -0.01, win rate 48%
- Stop 4.0×ATR: EV -0.04, win rate 44%
From these results, I concluded that tighter stops were better.In reality, this was completely incorrect.
Trend after the fix (true)
- Stop 1.0×ATR: EV -0.058, win rate 46%
- Stop 1.5×ATR: EV -0.041, win rate 48%
- Stop 2.0×ATR: EV -0.028, win rate 50%
- Stop 3.0×ATR: EV -0.019, win rate 52%
- Stop 4.0×ATR: EV -0.015, win rate 54%
Completely opposite. The principle is that “wider stops yield higher EV.” Had I operated under the pre-fix judgment in production, I would have certainly lost real money.
The belief that “tight stops” are a universal trap in the industry
This also applies to commercial EA products on the market.Most EAs advertised as increasing win rate with tight stops are likely to contain this class of bug.
Backtests show better results when you tighten the stops because the bugs inflate performance. A typical EA that collapses in real trading is often tied to this pattern.
From here on, I will coverthe two bugs in detail (with code examples), the rechecking results for all affected projects, and three checkpoints to avoid the same traps in your own EA.
Whether you are building EAs or just starting, this is useful.
What follows (continued) will be published here:
- Bug ①:Both entry and exit were executed within the same bar(the true cause of the false positive t-value +112)
- Bug ②:The entry bar’s own stop was not being evaluated(the root of the tight-stop belief)
- Affectedprojects recheck listand any changes to conclusions
- Three checkpoints to avoid the same traps in your own EAthree verification steps
- What to do the moment you see an “abnormally good” numberthree checks