Hi everybody, I already sent this to the Service Desk, but then they decided to not take this kind of answers anymore, so I'll try ma luck here if anyone has experienced something similar and knows a solution.
This is a problem, that only started with one of the newest versions (some update this year, as when I last optimized my WE in December, everything was fine).
Basically, the problem is this: my EA creates a handle to iATR at initialization and then uses those values to trade.During testing or optimization this works fine, as long as no Stop Out occurs. What then happens is this:
Let's assume I don't optimize, but run some backtests with manually changing some parameters.
1) let's say the first 10 runs with different sets or parameters work fine. Sometime you lose, sometimes you win.2) in the 11th run, the EA performs as usual, but for example after 2 years of backtesting, I get stopped out.3) when I restart the tester immediately, without changing anything, one would assume the same result as under point 2), right?However this crashes instantly and further examination of what's going on showed: the iATR in initialized, gets the same handle as under 2), but CopyBuffer only returns zeros, never any real values.
4) Restart metatrader, and we're back to point 2) of running and getting stopped out.
Has anybody got any advice for me?Main problem right now is, that I cannot optimize my EA anymore. I have 6 cores in my computer, they all perform their tasks flawlessly. But as soon as one gets stopped out, the other 5 continue to run as planned, but that stopped out one produces crash after crash based on what I described above.
I'm pretty sure a behaviour like this will hardly stem from my code, as even the worst written code should reproduce the same results.So maybe you have any idea or suggestion to totally reset metatrader/my EA/... at the start of each run?
Thanks so much in advance,right now, I cannot use this program anymore :(
if nobody is able to help, can at least somebody explain if this issue exists only for me, or if you have witnessed something similar?
Did you try to not restart the tester immediately ?
It takes some for the terminal to free all the data and handles.
Even a simple sleep could fix it, or you can try and check the result if it is non zero before proceeding.
Sorry, didn't notice your answer until now.
Well, when I restart it manually, it takes a couple of seconds anyway, that should be enough to clear the memory I guess.
But of course I also included code that checks for various issues, and stops after ten seconds and it always does...
If your EA checks the entry conditions at each tick price, please try checking the entry conditions is for each new candle bar only on a lower time scale, for example M1 or M5.
For exampleif your EA is running on H1, then your EA will check the entry conditions if the last M1 or M5 has finished. I mean that the process is done once - at every 1 candle M1. Process memory is needed only on 1 structure on each new bar M1.
Because if the process is carried out in every running tick price, thenthere is no memory released in the main loop structure.
I hope I did not missed anything above :)good luck
Hi and thanks for your response!
No, I only check after each M1 candle, so this also shouldn't be the problem.
And as always mentioned: it never behaved like this before the last update and also runs, that work till the end, don't mess things up (but it should be the same if it's imply a timing thing, right?).
But what really surprises me, is that I seem to be the only one with the problem. Sure other also tried to optimize strategies where single runs ended in a StopOut, but seemingly nobody experiences my problems afterwards...
Also a problem here: as far as I know, Sleep() doesn't work during testing, so I cannot even try to "wait till all is settled"...
Basically, the problem is this:
I've not run into that specific problem. I have run into sporadic problems with the backtester before on an issue like this, but not the same issue.
Has anybody got any advice for me?
1. Go back to a prior version of MT5 and use that. Hope that future releases will fix the issue.
2. Dig further into your code to determine if there is anything specific causing this instability. I spent two days, about 10 hours each, ferreting out the problem I mention in the above link, but I was unable to find it or correct for it. I was able to find a minimum test example for the Service Desk. So I am not saying this will work—but due diligence and all that.
3. Post your findings on the Russian forum. I think more admins and people "close to the source" hang out there.
Clock: Hi and thanks for your response!
There are several bugs like that in build 1881. I didn't get the same like you but I got others similar where the only solution is to restart MT5.
Solutions are like explained by Anthony.
Forum on trading, automated trading systems and testing trading strategies
Memory / Indicator error after Stop Out?
Anthony Garot, 2018.10.11 17:35
Don't waste time checking code in your case, it's obviously an MT5 issue.
I would add an other option, if applicable for you, try an other platform if you want a professional support. Metaquotes absolutely doesn't care about you and your problems.
Haha, last line absolutely hits it.
I mean, when they still had the service desk, I was impressed and didn't mind that quite a few help pages never got translated from russian.
But since they scrapped that too, you're pretty much lost here.
Okay, so I'll look out for an older version and obviously never restart, or you do you prevent MT5 from auto-updating?
Big thanks to Anthony! This really sounds like a similar problem, although seemingly not as repeatable as mine. Mine really happens exactly the same all the time, so it must be a structural problem.
But, this still was nothing compared to my issue with the newest beta, but this I already posted in the corresponding thread.
Happy to say: the newest updates (currently running 1916) finally fixed this problem!
Please enable the necessary setting in your browser, otherwise you will not be able to log in.