Hello,
I'd like to have an EA load a centralized time from the internet. For example GMT. How to do it?
Like TimeCurrent() but then from one location at the internet. Cause if you use TimeCurrent() it differs from broker to broker. I want to have one and the same time over different brokers, different machines and different locations, to store things to log files and later be able to compare things from a central time point.
Thanks!
Use your PC time logic
Read https://www.mql5.com/en/code/10459
Also Comments
Hello,
I'd like to have an EA load a centralized time from the internet. For example GMT. How to do it?
Like TimeCurrent() but then from one location at the internet. Cause if you use TimeCurrent() it differs from broker to broker. I want to have one and the same time over different brokers, different machines and different locations, to store things to log files and later be able to compare things from a central time point.
I've read it. I see TimeLocal() and TimeCurrent() being used. Meaning it will depend on broker and machine. I'd like to use one and the same source.
Example:
From:
GMT_TimeTransmitter
To:
VPS1 in London
VPS2 in New York
VPS3 in Amsterdam
I'm aware of the latency issues. Though to me it seems the best option.
@RaptorUK I thought so, was hoping that any of you had some solution for it. I can only think of clumsy solutions like running using one MT4 account and run this at every machine and use the TimeCurrent() from that as "central time" .
#import "kernel32.dll" void GetLocalTime(int& LocalTimeArray[]); void GetSystemTime(int& systemTimeArray[]); int GetTimeZoneInformation(int& LocalTZInfoArray[]); bool SystemTimeToTzSpecificLocalTime(int& targetTZinfoArray[], int& systemTimeArray[], int& targetTimeArray[]); #import
see the version at Donna forex forum in the link given in the comments you will see where to find the best version
log in there and you can download
in the indicator you have the logic to go from your local time to gmt
and how to calculate summertime in other countries
I know it's not what you wan't but could you settle for a GMT offset extern variable which calculates all times back to GMT? It's what I do because it's quick and easy, just need to remember when changing broker.
extern int gmt_offset = 3; datetime gmt_now = TimeCurrent()-gmt_offset*3600 // (60minutes times 60 seconds)
I've also considered streaming GMT time from a free API from a website? (can I post a link?)
I know it's not what you wan't but could you settle for a GMT offset extern variable which calculates all times back to GMT? It's what I do because it's quick and easy, just need to remember when changing broker.
summertime resetting is not the same weekend in different countries
some countries have summertime setting some have not
when its winter here in netherlands then it is summer Australie
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I'd like to have an EA load a centralized time from the internet. For example GMT. How to do it?
Like TimeCurrent() but then from one location at the internet. Cause if you use TimeCurrent() it differs from broker to broker. I want to have one and the same time over different brokers, different machines and different locations, to store things to log files and later be able to compare things from a central time point.
Thanks!