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
Just a guess: try to disable the visual mode and/or choose real ticks.
Unfortunately... :( Neither disabling visual mode or choosing real ticks helps.
I also switched to a live account on the same provider (I was on demo) but didn't help.
After searching for a long time I discovered that the error arrives in that command:
second command in the `SetLocalTime`.
Strangely enough, the TimeGMT() method returns a strange date (a week later) even though no ticks have arrived inside the expert (I have breakpoint to be sure) and we are still inside the OnInit().
Further more, when I comment out the `CheckLoadHistory(symbol, PERIOD_H1);` inside the `string CTimeZoneInfo::FindSymbol(string symbol)` method it returns correct values.
Not sure of what could affect the ::TimeGMT() method inside the CheckLoadHistory but I will continue investigating it and inform you about my findings.
In any case I don't believe that the TimeGMT should return different date on subsequent call unless new ticks arrive. As such I am thinking that Metatrader has some kind of bugs...
Latest findings...
There is definitely an issue with the `Sleep` method inside the `CheckLoadHistory`.
If I change it to something like:
I see the TimeLocal() switching by 5 seconds.
The problem becomes worse if I change it to:
The more loops using GetTickCount() and Sleep() and becomes worse.
Inside the `CheckLoadHistory` it has the following loop which is the one that creates the issue.
Did something change in the later versions of Metatrader?
Removing the Sleep statement as bellow it fixes the problem and returns correct day.
There is definitely an issue with the `Sleep` method inside the `CheckLoadHistory`.
Fixed in v2.17.
Thanks @Efthymios Kalyviotis and @Rob Josephus Maria Janssen for detecting this bug.