Most first EAs I look at are not broken because the idea is bad. They are broken
because of a handful of details that never throw an error - the EA just behaves
differently than the author thinks it does. Here are the five I check first.
1. Running the logic on every tick instead of on a new bar
If your entry condition uses the closed candle, it has to be evaluated once per
bar. Inside OnTick without a guard it is evaluated hundreds of times, and the
same signal fires again and again. The usual fix:
Symptom when it is missing: far more trades in the tester than the chart
suggests, often several within the same candle.
2. No unique magic number
Without a magic number the EA counts, modifies and closes positions that belong
to you or to another EA on the same account. Set it once and filter by it
everywhere - position loops, history loops, close routines:
Symptom when it is missing: the EA closes a manual trade you opened yourself, or
two EAs on the same symbol start fighting over the same position.
3. Lot size not normalized to the broker
Every symbol has a volume step, a minimum and a maximum. A calculated lot size
like 0.0374 or a hand-typed 0.15 on a 0.1-step symbol is rejected with error
10014 "Invalid volume" - and the EA usually just logs it and moves on:
Symptom when it is missing: works on one broker, sends nothing on another.
4. Points and pips treated as the same thing
On a 5-digit broker one pip is ten points. A stop loss entered as "20" is 2 pips
if the code multiplies by _Point and 20 pips if it multiplies by a pip factor.
The same input then means something completely different per symbol:
Symptom when it is missing: stops that sit absurdly tight on some symbols and
absurdly wide on others - and gold or indices behave differently again.
5. Testing with the wrong modelling mode
"Open prices only" is fast and tells you almost nothing about an EA that reacts
intraday or uses a stop inside the candle. It cannot know where price went
between open and close, so it guesses. Use "Every tick based on real ticks" for
anything that is not a pure bar-close strategy, and compare the two runs - if
the results differ wildly, the strategy depends on intrabar behaviour and the
faster mode is lying to you.
Symptom when it is wrong: a beautiful equity curve that does not survive a
forward test.
How I work through these
Before I look at the strategy at all, I read the file top to bottom once and
only look for those five things. It takes a few minutes and it removes most of
the "why is it doing that" questions before they come up. Only then do I start
testing the idea itself, because otherwise I am testing the bugs, not the
strategy.
Curious what others add to this list - what breaks most often in the EAs you see?
- Can't find bug, please help
- Can someone help me iCustom
- [Strategy Tester] execution speed slowing down exponentially while backtesting an EA
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register