TimeGMT and TimeGMTOffset and Daylight Savings???

 

RaptorUK told me to not double-post. I understand, but wanted to make a separate thread since I see this as something particularly easy for MetaQuotes to fix if they so desired, and an important subject that IMHO affects sessions, news, pivots, etc., so my original posts can be seen here:

https://forum.mql4.com/60555/page38#909264

https://forum.mql4.com/60555/page39#909811

My point remains the same:

There is no reason that if MetaQuotes provides something, they provide it wrong. Does it not make sense what I say when I say that GMT offset should be defined as Broker time - GMT time divided by an hour of time (60 x 60 = 3600)? And that GMT offset has nothing to do with DST or local? This is true. DST is handled separately by me, and should be handled separately by MetaQuotes. News deals with only GMT offset. Sessions deals with GMT offset and DST, but DST only twice a year, when New York changes. That's when Forex Factory says that GMT times change for sessions. And I follow them since they are a better authority than I am, and many people use their website to tell when sessions are, news times, etc., so I use their data in my softwares.

Here is where I show that although GMT time changes in March and November in GMT time, when combined with the GMT offset changing at each broker, 3 of the 4 sessions stay the same all year round, only Tokyo changes:

When DST is OFF:

Forex day open: 5pm EST / 10pm GMT (22 GMT)


GMT:

4 hours: 22, 2, 6, 10, 14, 18

Sydney: 22 - 7

Tokyo: 0 - 9

London: 8 - 17

New York: 13 - 22


On FXDD (GMT+2):

4 hours: 0, 4, 8, 12, 16, 20

Sydney: 0 - 9

Tokyo: 2 - 11

London: 10 - 19

New York: 15 - 24


On MBT (GMT-5):

4 hours: 17, 21, 1, 5, 9, 13

Sydney: 17 - 2

Tokyo: 19 - 4

London: 3 - 12

New York: 8 - 17


When DST is ON:

Forex day open: 5pm EST / 9pm GMT (21 GMT)


GMT:

4 hours: 21, 1, 5, 9, 13, 17

Sydney: 21 - 6

Tokyo: 0 - 9

London: 7 - 16

New York: 12 - 21


On FXDD (GMT+3):

4 hours: 0, 4, 8, 12, 16, 20

Sydney: 0 - 9

Tokyo: 3 - 12

London: 10 - 19

New York: 15 - 24


On MBT (GMT-4):

4 hours: 17, 21, 1, 5, 9, 13

Sydney: 17 - 2

Tokyo: 20 - 5

London: 3 - 12

New York: 8 - 17

So what I do is built my own DST code to give me a 1 or 0, based around NewYork/ForexFactory GMT time change, and use that 1 or 0 in my code to subtract from Hours when DST is OFF.

Kindest regards,

Don

 
disbellj:

RaptorUK told me to not double-post. I understand, but wanted to make a separate thread since I see this as something particularly easy for MetaQuotes to fix if they so desired, and an important subject that IMHO affects sessions, news, pivots, etc.,

The best way to get your suggestion to MetaQuotes is via the Service Desk <--- click link for instructions
 
RaptorUK:
The best way to get your suggestion to MetaQuotes is via the Service Desk <--- click link for instructions


Thanks RaptorUK! MQL5 forum instead of MQL4 forum to get MetaQuotes to hopefully listen to reason. Got it! :)

Kindest regards,

Don

BTW, what do you think of my revised first post? I put information there that took me time to work out for myself. Hope it is useful to the community.

 
disbellj:


Thanks RaptorUK! MQL5 forum instead of MQL4 forum to get MetaQuotes to hopefully listen to reason. Got it! :)

Kindest regards,

Don

BTW, what do you think of my revised first post? I put information there that took me time to work out for myself. Hope it is useful to the community.

Isn't a simple solution just to know what the current UTC time is ?
 
disbellj : Here is where I show that although GMT time changes in March and November in GMT time,
So what I do is built my own DST code to give me a 1 or 0, based around NewYork/ForexFactory GMT time change, and use that 1 or 0 in my code to subtract from Hours when DST is ON.
  1. No it does not. GMT is GMT is UTC. There is no GMT with daylight time. London time is NOT GMT during the summer (BST) GMT doesn't change, when the markets open (EST/EDT) and sessions start change depending on local time. Be careful with the terminology.
  2. See also my (B5xx) code.
 
WHRoeder:
  1. No it does not. GMT is GMT is UTC. There is no GMT with daylight time. London time is NOT GMT during the summer (BST) GMT doesn't change, when the markets open (EST/EDT) and sessions start change depending on local time. Be careful with the terminology.
  2. See also my (B5xx) code.


GMT time has nothing to do with Daylight Savings. This is True. And in news (FFCal), only GMT offset is needed or dealt with.

BUT, when you go to Forex Factory, and you check Session times between march and november, and then again between november and march, the session times do change in GMT time. You can click on session times on following link from my webpage to see what I got from Forex Factory: <link removed by moderator>

Oddly, when looking at those GMT times, when DST is OFF (now), Sydney begins at 22:00 GMT. But in March, when DST is ON, Sydney begins at 21:00 GMT. So an hour is actually subtracted (when DST is on, per NY, I get a 1 returned from function I made myself). Right now I get a 0 returned. So right now, 22-0=22. But in March, my code will produce 22-1=21 GMT. Then after that the GMT offset is added. Two separate things. But these two separate things go together so that practically the times are the same on a broker all year for Sydney and London and New York sessions (not Tokyo). Not because the session times are the same all year in GMT, but because together with DST offset changing on the brokers, the times work out to being the same.

Put another way, FXDD starts at correct Forex 17:00 ET all year round. Start hour is 0, which is also hour 24 of previous day. 24-3 GMT offset during summer = 21 GMT Forex start day. During winter, 24-2 GMT offset = 22 GMT Forex start day.

As far as market hours /session times in GMT, I get these from years of seeing conflicting numbers and finally deciding to go with Forex Factory information given.

And if I have a strategy that trades the open of London or open of New York, then time is important, and being off an hour will make a difference.

Kindest regards,

Don

 
disbellj:


GMT time has nothing to do with Daylight Savings. This is True. And in news (FFCal), only GMT offset is needed or dealt with.

BUT, when you go to Forex Factory, and you check Session times between march and november, and then again between november and march, the session times do change in GMT time. You can click on session times on following link from my webpage to see what I got from Forex Factory: www.tinyurl.com/disbellj

Please use the link button to post URLs
or Control-Alt-L
Use link
(see the difference?)http://www.tinyurl.com/google
  1. As I said "There is no GMT with daylight time"
  2. As I said "sessions start change depending on local time"
  3. There are many sites that give you the session start/end times. They are all wrong including yours, because DST starts on different dates for different countries (and you have to adjust those dates historically for back testing, e.g. ET 2006 & earlier.) Most don't even get market open/close correct (6pm ET Sunday/4pm ET Friday)
 
disbellj:

...

Hello,

Please note that you are not allowed to advertise on this forum. So I removed your link.

Thank you.

 

I'll continue to go by Forex Factory GMT times, which change twice a year. There should be no confusion or argument about this, but since there is confusion it seems, then I believe it's MetaQuotes duty to help everyone get on same page by telling us all what the session times are. If they differ from Forex Factory, then it seems brokers need to come to agreement. It's hard enough trying to make money in Forex. For it to be hard to know what session one is in is unacceptable IMO, so I've done the best I can and will continue to do so.

Kindest regards,

Don

 
disbellj:

. . .

So what I do is built my own DST code to give me a 1 or 0, based around NewYork/ForexFactory GMT time change, and use that 1 or 0 in my code to subtract from Hours when DST is OFF.

. . .


I've previously posted code and information about calculating the start and end dates for American DST and European DST.

Here are two functions that use those calculations:

American DST

bool AmericanDST(int year, datetime& DST_Start, datetime& DST_End) {
   if (year < 1987) 
      { Print ("AmericanDST(): Invalid year."); return (false); }
   
   int DST_start_dom = 0, DST_end_dom = 0;
   if (year >= 1987 && year <= 2006) {
      DST_start_dom = 1 + MathMod((2 + 6*year - year/4), 7);   
      DST_end_dom = 31 - MathMod((1 + 5*year/4), 7);           
      DST_Start = StrToTime(StringConcatenate(year, ".04.01")) + ((DST_start_dom - 1) * 86400) + 7200;  // first Sunday in April
      DST_End = StrToTime(StringConcatenate(year, ".10.01")) + ((DST_end_dom - 1) * 86400) + 7200;      // last Sunday in October
   }
   else if (year >= 2007) {
      DST_start_dom = 14 - MathMod((1 + 5*year/4), 7);        
      DST_end_dom = 7 - MathMod((1 + 5*year/4), 7);             
      DST_Start = StrToTime(StringConcatenate(year, ".03.01")) + ((DST_start_dom - 1) * 86400) + 7200;  // second Sunday in March
      DST_End = StrToTime(StringConcatenate(year, ".11.01")) + ((DST_end_dom - 1) * 86400) + 7200;      // first Sunday in November
   }
   
   return (true);
} 

European DST

bool EuropeanDST(int year, datetime& DST_Start, datetime& DST_End) {
   if (year < 1996) 
      { Print ("EuropeanDST(): Invalid year."); return (false); }

   int DST_start_dom = 0, DST_end_dom = 0;
   DST_start_dom = 31 - MathMod((4 + MathFloor(5*year/4)), 7);
   DST_end_dom = 31 - MathMod((1 + MathFloor(5*year/4)), 7);
   DST_Start = StrToTime(StringConcatenate(year, ".03.01")) + ((DST_start_dom - 1) * 86400) + 3600;     // last Sunday in March 
   DST_End = StrToTime(StringConcatenate(year, ".10.01")) + ((DST_end_dom - 1) * 86400) + 7200;         // last Sunday in October

   return (true);
}

Using the dates returned by the above functions, one could determine whether a specific date/time is within American or European DST.

Reason: