Broker/Server Timezone

 

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?

 
  1. TimeGMT() as it is highly dependent on the PC's setup of the time and timezone. So should those not be correctly setup or not in sync with an external time server, the results could be misleading.
  2. DST is dependent on region (e.g. European DST is not the same US DST), so if your machine is set to a different DST to that of the Brokers, things can get complicated.

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).

Thanks again.

 
owkenobi:

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).

Thanks again.

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.

 
FMIC:

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.

Hi FMIC,

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().

Thank you!

 
owkenobi:

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).

Thanks again.

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.

Reason: