Using the same EA over the same period results in different outcomes — MT4 remembers "the previous settings"
While testing EA, have you ever had experiences like this?
I ran backtests on the same EA, the same currency pair, and the same period as yesterday, yet the number of trades and the profit and loss came out different. Even after reviewing the settings, I don’t recall changing anything.
The other day I spent a whole day on this. The cause was not the EA or the market data,but MT4 remembered the previous parameters and gave them priorityand ran with values that differed from both the values displayed in the Strategy Tester screen and the contents of the file I had provided.
If you don’t know, you might incorrectly conclude that “this EA is non-reproducible,” so I will share the measured numbers along with the results.
What happened
For an EA, I was checking whether the trading results completely match between a cleaned-up version and the original version. I did not touch the logic at all; I only increased the externally changeable parameters, so if run with default values, the results should be identical for every trade.
The conditions are as follows.
- USDJPY / M5
- 2019-01-01 to 2026-01-01 (7 years)
- Open prices only / spread 20
The first run was as expected.
- Original version1345 trades/ Cleaned version1345 trades
- Matched all 1345 trades in order of executionAll 1345 cases matched (100.0%)
- Profit factor and maximum drawdown also perfectly matched
The problem was the following. After trying a few parameter variations to gauge the feel, I returned once again to a “comparison with defaults,” andthe match rate dropped to 17.9%.
I hadn’t changed a single byte of the code. The period and the spread were the same. Yet more than 80% of the trades among the 1345 trades diverged.
Normally, one would conclude that the modification with additional parameters caused side effects. Honestly, I initially suspected that too.
However, this wasa complete misattribution.
The real culprit was not the EA but MT4
To reveal the culprit, in the immediate prior search I had set the “server time offset (GMT)” to 1 just once for exploration. That value carried over to the next run,so only the original version ran with GMT=1, while the cleaned version ran with GMT=0.
For an EA with a time filter, even a one-hour difference in server time is nearly equivalent to a market move. The entry eligibility changes, and all subsequent positions shift. So it was natural that 80% diverged.
What’s scary is thatthis state does not appear anywhere. The tester screen shows the usual display, and there are no errors or warnings. Both reports show numbers that seem plausible, so only the people who compared them end up mistakenly blaming the EA.
That is the phenomenon up to this point. From here, I will explain why MT4 becomes like this, and what exactly to do to perform reproducible verifications.