Scripts: Trading Session Mapping

 

Trading Session Mapping:

A tool to align the trading sessions names with broker server time, and local time

Trading Session Mapping

Author: Conor Mcnamara

 
Awesome , Thanks for sharing form me in GMT +13 it does my head in my broker is in +11 so at daylight saving it is difficult . Excited to check it out 
 
linfo2 #:
Awesome , Thanks for sharing form me in GMT +13 it does my head in my broker is in +11 so at daylight saving it is difficult . Excited to check it out 

I was getting very confused as well with the disparity between my timezone and the brokers timezone, so it drove me to build this. 

I have only tested the results with my own brokers timezone on GMT+3, I hope there are no bugs. We'll see if anyone catches anything

 
Conor Mcnamara #:

I was getting very confused as well with the disparity between my timezone and the brokers timezone, so it drove me to build this. 

I have only tested the results with my own brokers timezone on GMT+3, I hope there are no bugs. We'll see if anyone catches anything

will it detect if and when a broker changes to Daylight savings?
 
Michael Charles Schefe #:
will it detect if and when a broker changes to Daylight savings?
Yes it should as nothing is hardcoded. It will calculate the GMT offset depending on what it finds through MqlDateTime

The trick is that the session times are understood first in GMT, that is the base, and then the offset is computed
 
Conor Mcnamara #:

The trick is that the session times are understood first in GMT, that is the base, and then the offset is computed
nice.
 
does the script automatically adjust for daylight saving changes, or do we need to update the offsets manually when the clocks change?
 
lumache #:
does the script automatically adjust for daylight saving changes?

   It should do

lumache #:
do we need to update the offsets manually when the clocks change?

nope, as the offsets are dynamically computed based on the server time that it reads

int GetServerOffsetHours()
  {
   MqlDateTime gmt, local;
   TimeToStruct(TimeGMT(), gmt);
   TimeToStruct(TimeCurrent(), local);
   int offset = local.hour - gmt.hour;
   if(offset < 0)
      offset += 24;
   return offset;
  }