
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hey Alain,
of course, thank you very much. I stepped a bit deeper into it and will try to help you to understand the procedure. The problem mainly occurs after the timeframe just has changed, but not only. And we talk about a very general problem - behind - CopyRates(), CopyTime(), iTime() etc. which seem to occur in specific environments, cause approximately only 1 of 100 users report this, I am not sure if you will be able to reproduce the behaviour.
Procedure:
When the timeframe is changed, the main EA broadcasts a message to all its modules in a message queue which is executed during OnTimer(), and these modules use iTime() etc. to re-initialize. What I suspect is, that there is a general issue when functions like CopyRates() etc. request plenty of quote data during OnTimer().
Below you will find a code which was able to reproduce the problem on a future live account of AMP, using EURUSD (with a shift value of zero - no history data requested!) when switching quickly between timeframes this morning. I am using Windows Server 2012 with 8 GB of RAM on a VPS system.
Remarks:
- It never happens with MT4 - code is 1:1
- I am not sure if it happens with demo accounts
Code:
Hey Alain,
of course, thank you very much. I stepped a bit deeper into it and will try to help you to understand the procedure. The problem mainly occurs after the timeframe just has changed, but not only. And we talk about a very general problem - behind - CopyRates(), CopyTime(), iTime() etc. which seem to occur in specific environments, cause approximately only 1 of 100 users report this, I am not sure if you will be able to reproduce the behaviour.
Procedure:
When the timeframe is changed, the main EA broadcasts a message to all its modules in a message queue which is executed during OnTimer(), and these modules use iTime() etc. to re-initialize. What I suspect is, that there is a general issue when functions like CopyRates() etc. request plenty of quote data during OnTimer().
Below you will find a code which was able to reproduce the problem on a future live account of AMP, using EURUSD (with a shift value of zero - no history data requested!) when switching quickly between timeframes this morning. I am using Windows Server 2012 with 8 GB of RAM on a VPS system.
Remarks:
- It never happens with MT4 - code is 1:1
- I am not sure if it happens with demo accounts
Code:
I can test on a live account of AMP.
"This morning", we are Saturday, so it happens only when there is no ticks ? or doesn't matter ?
Forum on trading, automated trading systems and testing trading strategies
iClose(), iTime(), CopyRates() etc. takes seconds and crashes EA and MT5
Doerk Hilger, 2019.05.29 12:52
Thanks, I updated the function.
But anyway, this must be a kind of a bug, because I still have this issue and it happens from time to time and it happens when the Shift-value is ZERO.
This morning, EA is running since 48 hours, just like that in the middle of nothing, everything freezes and the function reports a timeout at _iTime(symbol,PERIOD_CURRENT,0). This should never happen, in no circumstance.
The change of the timeframe seems to be a method to force the issue, yes, but it also happens without such a change and during market hours as well as on weekendes. I just recognized this recently, thats why I mention the change of timeframes additionaly.
New testcode for infinite loop
By the way, I´d be very happy if some more people could use this code and let it run for some hours, because this is an issue which probably affects ANY expert and indicator - sooner or later.
No matter if you ever recognized this problem or not, I have a huge number of users and a few of them have this issue. So it´s just a matter of time, when your EA or indicator is affected too.
Thank you!
It may also be related to memory.
Have you looked into the EVENTVWR system log ?
It could show entries like Terminal.exe - 'APPLICATION_HANG' and give you an error code which you can Google to find out what exactly went wrong.
New testcode for infinite loop
It may also be related to memory.
Have you looked into the EVENTVWR system log ?
It could show entries like Terminal.exe - 'APPLICATION_HANG' and give you an error code which you can Google to find out what exactly went wrong.
Thank you, never did but will have a look at it next time.
Launched.
Thanx :)