Inexplicable MT4 Back Testing Errors

 

Hi everyone.

I’ve a bit of a head scratching problem with some back testing and I wanted to know if anyone else had ever experienced this or something similar.

I have an EA which I have developed and tested successfully over a period of 3 years – 2018 2019 2020. At its simplest, the EA opens positions with SL’s, TPs and TS’. Nothing crazy there.

During the first three tested periods (either separately or together), the EA was very stable and made a regular return. Open, trail, close, repeat. I documented my test results with screenshots.

I wanted to expand my testing backwards even further and so I tested 2017. Oops! Bad luck, the EA posted a large loss, killing the account. I investigated, and it looks like it opened an order which never closed and overwhelmed the account with float and margin.

Looking more closely at the logs, after opening this particular position the EA started to post non stop error 130’s. I’ve understood from reading the forum that this can be related to invalid SLs… and effectively this would be why the position never closed and killed the account.

I set this aside to look into further and continued running the test backwards: 2016, 2015, 2014, each year began with this issue and killed the account. I then went back to my previously recorded safe years 2018-2020 and found… that this problem appeared right away and killed the account each time, where previously it had worked well over the entire period.

I’ve reset my VPS and MT4, and the problem persists.

I’ve asked a colleague to test the EA over the same periods with the same conditions and he has only the stable results that I’d experienced previously.

There was recently a windows security update to my VPS during the testing, which is the only thing that has changed during the testing. Related or not? I’ve also reloaded the history data from my broker.

If I look at this logically, it seems to me that it is not a problem of EA but of some sudden and consistent problem with my tester / MT4 instance / VPS. But… what? How, and why?

The instance of MT4 in question is also used to run live EA’s during the week. So, if there is a bizarre problem with the EA it puts into question my faith in it being able to reliably run EA’s with live money.

Has anybody ever experienced something like this? If so, do you have a solution or workaround?

In any case if you’ve made it to the bottom of this post, thanks for your time  :)

Documentation on MQL5: Common Functions / TesterStatistics
Documentation on MQL5: Common Functions / TesterStatistics
  • www.mql5.com
TesterStatistics - Common Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Zippu: If I look at this logically, it seems to me that it is not a problem of EA but …

How To Ask Questions The Smart Way. 2004
          Don't rush to claim that you have found a bug.
Questions Not To Ask
          My program doesn't work. I think system facility X is broken.

It is almost always your code.

 
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.
 
Keith Watford:
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.
Thanks Keith sorry, I thought I had the right section. Thanks for the correction. 
 
Hi William, yes and I agree with you entirely that this is most often the case. 

Naturally I will also investigate the code. 

What is strange here is that the code is the same in all situations. It worked (and was documented), and then a few days later in the exact same scenario stopped working... All the while continuing to work on someone else's computer. 

I'm really just curious to know if anyone has had a similar issue, and if there are maybe alternative reasons for something like this to occur 🤔? 

Reason: