Date and time at the beginning of the line (2015.12.16 16:48:13.529) are taken from your pc at the time of the printout.
The other time (2015.12.16 15:29:56) is the close time of your broker.
What if the pc clock has been changed or is heavily lagging due to a bad load distribution of the vps by the vps-provider?
Date and time at the beginning of the line (2015.12.16 16:48:13.529) are taken from your pc at the time of the printout.
The other time (2015.12.16 15:29:56) is the close time of your broker.
What if the pc clock has been changed or is heavily lagging due to a bad load distribution of the vps by the vps-provider?
I checked previous reasons and no problem at all. It proves there is problem since the closed orders should be printed in the next tick once the order is closed.
The code has run 3 months without problem and just has problem today. So my doubt is same as what you mentioned on VPS speed.
Is it possible for the Sentences of new tick can start to run although the sentences of previous ticks haven't been executed or completed while VPS is slow?
How does MQL4 proceed while VPS is slow?
MQL4 can't recognize it.The only hint is that the 'virtual' pc clock gets slower and slower. Compare the times of the pc clocks.
I once realized that the clock of the vps was more that 30 min per day slower than real time.
The difference was so big that the ntp software refuses to set that vps clock. Of course the provider refuses any responsibility - so I quit!
MQL4 can't recognize it.The only hint is that the 'virtual' pc clock gets slower and slower. Compare the times of the pc clocks.
I once realized that the clock of the vps was more that 30 min per day slower than real time.
The difference was so big that the ntp software refuses to set that vps clock. Of course the provider refuses any responsibility - so I quit!
In my case, you can see the VPS time in the bottom-right is completely same as the MT4 server time. So believe it's not the issue of clock delay.
Instead, I'm doubting if this statement still works while CPU/Memory overloaded, "In case when OnTick() function for the previous quote is being processed when a new quote is received, the new quote will be ignored by an Expert Advisor".
Has any friend any idea or experience on it? Thanks in advance!
Any comment or suggestion is welcome!
MQL4 can't recognize it.The only hint is that the 'virtual' pc clock gets slower and slower. Compare the times of the pc clocks.
I once realized that the clock of the vps was more that 30 min per day slower than real time.
The difference was so big that the ntp software refuses to set that vps clock. Of course the provider refuses any responsibility - so I quit!
Dear Gooly,
I used "EventSetMillisecondTimer(20)" on Amazon free VPS and did observe the delay from the VPS local time after hundreds of "OnTimer()" cycles.
How can it happen as the VPS local time is still accurate? I'm confused. Is there something I can do in my code to prevent or mitigate the impact?
Besides, my code runs in same speed all the time.
However you can see the VPS CPU is about 8% at the begining and it rises up gradually with hours. Finally it always be 100% busy.
May I ask a favor for you to help me better understand this kind of issue? Thank you very much!
Amazon's VPS seems to be very slow. If you run your terminal directly on a pc it will get let's say every 10th cpu-tick - the other 9 are for other threads.
On a VPS (same situation) the terminal didn't get every 10th tick of the cpu but if there are 100 other clients every it will get only every 100*10 tick of the cpu. BUT for your terminal it is again only the t10th tick.
I had once a VPS where the clock delayed about 30 min per day it was so slow that even ntp-time refuses to set times!
Beside that after I complained the admin of the VPS logged in onto my VPS and changed the automatic time adjust of Windows!
Have you changed the option for the VPS-Admin to login to your VPS?
Amazon's VPS is meant for normal user and their individual web idea - I don't think it suits a trader (There is no free lunch!)
Beside that after I complained the admin of the VPS logged in onto my VPS and changed the automatic time adjust of Windows!
Have you changed the option for the VPS-Admin to login to your VPS?
Dear Gooly,
Thanks a lot. But how to change the option?
Dear Gooly,
I used "EventSetMillisecondTimer(20)" on Amazon free VPS and did observe the delay from the VPS local time after hundreds of "OnTimer()" cycles.
How can it happen as the VPS local time is still accurate? I'm confused. Is there something I can do in my code to prevent or mitigate the impact?
Besides, my code runs in same speed all the time.
However you can see the VPS CPU is about 8% at the begining and it rises up gradually with hours. Finally it always be 100% busy.
May I ask a favor for you to help me better understand this kind of issue? Thank you very much!
Hello,
The difference of the time you are expecting and the local time passed may be there in case your program needs more than 20ms for each iteration to complete; in that case, your estimated (expected) time should appear as less than the time passed
Regarding CPU going from 8% to 100%, I believe it is the result of Amazon Cloud automatically allocating the necessary CPU power to your program - and no more than that, so probably no problem here
best regards
Hello,
The difference of the time you are expecting and the local time passed may be there in case your program needs more than 20ms for each iteration to complete; in that case, your estimated (expected) time should appear as less than the time passed
Regarding CPU going from 8% to 100%, I believe it is the result of Amazon Cloud automatically allocating the necessary CPU power to your program - and no more than that, so probably no problem here
best regards
Do you think the code below in "OnTimer()" costs over 20 ms to run?
input int timePeriod=50; int timeTick=0; ulong iniTime,curTime; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- create timer EventSetMillisecondTimer(timePeriod); iniTime=TimeCurrent(); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- destroy timer EventKillTimer(); } //+------------------------------------------------------------------+ //| Timer function | //+------------------------------------------------------------------+ void OnTimer() { //--- string display="\n"; timeTick++; curTime=TimeCurrent(); display+=TimeToStr(curTime,TIME_DATE|TIME_SECONDS); display+=StringFormat("\nEvent Ticks: %i Real Ticks: %u",timeTick,(curTime-iniTime)*1000/timePeriod); Comment(display); } //+------------------------------------------------------------------+

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
So frustrated I haven't any idea how this happened!
The code ran on 2 brokers for 3 months. Today the issue below suddenly happened at 1 broker.
Please refer to the log and code below. The code should run sentence by sentence based OnTick. However, please refere to the time marked in yellow. Why were the closed orders printed after hours?
I thought and thought, but thought of nothing about the root cause except the doubt. Sentences of new tick can start to run although the sentences of previous ticks haven't been executed or completed while VPS is slow.
Is it possible? How do the MQL4 code run indeed? Please, please help!!! Thank you very, very, very much!!!