The EA Development Loop (1/10): A good EA is never finished in one pass

22 November 2026, 17:04
Naoto Shimoda
0
21

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"

  1. It stays profitable when tested on data close to real market conditions.
  2. You know in advance how deep it can fall in its worst period.
  3. On a live account it behaves almost the same as in the backtest.
  4. 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 1

The 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

StageToolsWhat I look at
Designpaper, spreadsheet, specpass/fail lines (PF, number of trades, max drawdown)
Rough testMT5 tester "1 minute OHLC", PythonPF and trade count per idea (never published)
ImplementMetaEditorzero compiler warnings, logs
Re-testMT5 real ticks, real ticks imported into MT4, demo and public accountsequity 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

  1. The loop (this post)
  2. Design: hypothesis and pass/fail lines before code
  3. Rough testing: filter many ideas fast
  4. Implementation 1: time, lot size, state recovery
  5. Implementation 2: surviving failed orders and lost connections
  6. Real-tick testing
  7. Estimating the worst case and minimum capital
  8. Avoiding over-optimisation
  9. Re-testing: feeding live results back into the design
  10. Checklist and the EAs built with this loop