UseTimeCurrent()
The GetTickCount function in the beginning of each OnTick with saving of the tick time. And in other On-functions you add the time difference to the remembered time via GetTickCount.
If there are ticks, there is no question. What if the first run is on a weekend?
GetTickCount is not needed at all. Using the first tick, calculate the difference between TimeCurent() and TimeLocal() in hours. Then TimeLocal() should be recalculated with this correction.
If there are ticks, there is no question. What if the first run is on a weekend?
GetTickCount is not needed at all. Using the first tick, calculate the difference between TimeCurent() and TimeLocal() in hours. Then TimeLocal() should be recalculated with this correction.
Sometimes it needs more accuracy.
Sometimes you need to be more precise.
Server time is not the time of the quote, it only differs by hours, the speed of data delivery cannot affect it in any way. It is the quote that has the time of its appearance and the lag due to the time it takes to transmit it.
The most interesting thing, as always, is ignored - how to make it work when it first runs at the weekend.
By TimeLocal.
paññata
On TimeLocal.
Please expand the thought a little bit. We started on Saturday. We have TimeCurrent() - Friday 23:59:59. What's next?
Spread the idea around a bit, please. Started on Saturday. We have TimeCurrent() - Friday 23:59:59. What next?
You have to ask developers this question, it would be more correct. It is not enough to get server time on weekends by standard means.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Interested in solving this function on MT4
TimeTradeServer