TimeCurrent() is a function to get the last known server time, and TimeGMT() give us the GMT time.
The difference, expressed in hours, between the 2 values give us the server timezone (for example +2 or -5 referred to GMT time).
My (simple) question is: is this value always the same or does it change during the year according to server Daylight Saving Time (DST)?
In other words, is the Metatrader platform broker time affected by broker TimeZone/DST region settings?
So in conclusion, yes - DST will affect the difference between TimeCurrent() and TimeGMT(), therefore the difference does NOT give the timezone but the delta from GMT.
Hello FMIC and thank you for the answer.
Unfortunately what you tell me confirms my fears.
I was conscious of the different periods in which each country enters DST, but this is a solvable problem collecting DST/Timezone data for the interested cities (Sydney, Tokyo, London and New York).
The variability of the timezone of the broker, instead, is a problem that cannot be solved by working with historical data.
I can not say in fact that TimeCurrent()-TimeGMT() calculated today will be valid to show graphically the opening and closing of the market in those cities in thr past (with historical data).
Ok, I will try to figure it out and solve this problem in nother way (windows API for example).
TimeGMT() is not useful in the Strategy Tester anyway as it is always local time!
However, since most brokers publish their Time-zone and DST settings, you can do the reverse and it will be a reliable way to workout the open/close times of sessions around the world.
yes TimeGMT() is, eventually, useless. For my purposes at least.
I like your idea about servers, because it let us play only with Time and iTime().
There is no reliable way to do that automatically on historical data. Unless you registered the TZ/DST of the broker server, which is certainly not very reliable. The broker can change its server TZ/DST, how could you be sure about these information ? maybe some broker can publish it but how to know it's always reliable ?
Anyway, in my opinion it's just waste of time to try to work with such accuracy on the Strategy Tester, past data are just past data. It makes sense on a live chart of course.
To add comments, please log in or register