The EA Development Loop (1/10): A good EA is never finished in one pass
I build and sell Expert Advisors and indicators for MT4 and MT5. In this 10-part series I want to describe the process I actually use: design, test, implement, and test again, as a loop rather than a straight line.
The first parts are written so that beginners can follow. Later parts include MQL5 code. I will not describe entry rules of any specific strategy. The process works whatever your strategy is.
What I mean by a "good EA"
- It stays profitable when tested on data close to real market conditions.
- You know in advance how deep it can fall in its worst period.
- On a live account it behaves almost the same as in the backtest.
- There is a procedure for rebuilding it when the market changes.
Many EAs satisfy point 1. Points 2 to 4 only come from re-checking the EA after it is built, again and again.
The four stages
[1. Design] hypothesis and pass/fail lines on paper
|
[2. Rough test] fast data, filter out weak ideas
|
[3. Implement] MQL code that survives a live account
|
[4. Re-test] real ticks, worst-case estimate, live vs. backtest
|
+--- when something does not match ---> back to 1The key rule: when stage 4 shows a mismatch, do not hide it by tweaking a parameter. Go back to the design and find the reason. A mismatch you hide with a parameter usually comes back on the live account.
Why one pass is never enough
Two things from my own testing:
- A trailing exit had a profit factor of 1.48 when I traced it on 1-minute OHLC bars. On MT5 real ticks the same rule gave 0.92 (part 6).
- In a 2-year backtest of a gold EA, the largest adverse move against one basket was about 59 dollars. On the night of 3 November 2026, gold moved about 63 dollars in roughly an hour and a half (part 7).
Neither was a coding bug. Both were problems of test method and design assumptions.
Tools for each stage
| Stage | Tools | What I look at |
|---|---|---|
| Design | paper, spreadsheet, spec | pass/fail lines (PF, number of trades, max drawdown) |
| Rough test | MT5 tester "1 minute OHLC", Python | PF and trade count per idea (never published) |
| Implement | MetaEditor | zero compiler warnings, logs |
| Re-test | MT5 real ticks, real ticks imported into MT4, demo and public accounts | equity drawdown, live vs. backtest |
Real-tick tests are slow, so I run many MT4 and MT5 terminals in parallel on several PCs. With many terminals, keeping track of "same conditions" becomes a job of its own (part 9).
Series outline
- The loop (this post)
- Design: hypothesis and pass/fail lines before code
- Rough testing: filter many ideas fast
- Implementation 1: time, lot size, state recovery
- Implementation 2: surviving failed orders and lost connections
- Real-tick testing
- Estimating the worst case and minimum capital
- Avoiding over-optimisation
- Re-testing: feeding live results back into the design
- Checklist and the EAs built with this loop


