Determine start of Asian Session (Tokyo) independent from brokers server time

 

Hello,


I do need to determine the start of the Asian Session (Tokyo) within my EA without using the brokers server time or any kind of online-check by connecting to a server. Most of the time the Asian Session (Tokyo) is at 00:00 at the brokers server time (for example: Global Prime, IC Markets, etc.) and they also always adjust the DST for their servers, but some brokers use completely different offets and I need a reliable way to check if the Asian Session (Tokyo) just started or not, totally independent from the brokers server-time. Can anyone help? I am OK at normal EA coding, but when it comes to time-management like this, I am always pretty much lost.


Thanks so much :-)

 
Lorenz Vauck: Most of the time the Asian Session (Tokyo) is at 00:00 at the brokers server time (

Wrong. Completely broker dependent.
          Time zone - Trading Systems - MQL5 programming forum #2 2020.11.13

 
Not sure what exactly you want, but that´s exactly what I said too. Maybe you read before you post? I just mentioned 2 examples of brokers where the Tokyo session starts at 00:00 of the brokers server time all year long, because they adjust their server time like this (for example: Global Prime and IC Markets). But then mentioned "but some brokers use completely different offsets" and that is the reason that I need to code something to detect this in the first place. It was the whole reason of my initial post. So thanks for your useless comment and for wasting both of our time with something that I already initially mentioned and which was my whole reason for posting here.
 

you might want to look at this: 


SymbolInfoSessionTrade(
   string            name,                // symbol name
   ENUM_DAY_OF_WEEK  day_of_week,         // day of the week
   uint              session_index,       // session index
   datetime&         from,                // session beginning time
   datetime&         to                   // session end time
   );

datetime from, to;
// 0 = Asian session
// this corresponds with market open time which varies with different instruments
if (SymbolInfoSessionTrade(Symbol(), WEDNESDAY, 0, from, to)) {
        Print("Daily market open time: ", TimeToString(from);    
}
 
Lorenz Vauck:

I do need to determine the start of the Asian Session (Tokyo) within my EA without using the brokers server time or any kind of online-check by connecting to a server. Most of the time the Asian Session (Tokyo) is at 00:00 at the brokers server time (for example: Global Prime, IC Markets, etc.) and they also always adjust the DST for their servers, but some brokers use completely different offets and I need a reliable way to check if the Asian Session (Tokyo) just started or not, totally independent from the brokers server-time. Can anyone help? I am OK at normal EA coding, but when it comes to time-management like this, I am always pretty much lost.

If you want to automatically calculate the difference between your broker-dealer's trade server time and your local pc time (with an alert for difference changes), see the indicator code at:

On-Chart Time Converter for MT5
On-Chart Time Converter for MT5
  • www.mql5.com
I don't know about you but If I have to think too much about time zone conversion without a visual aid, my head starts to spin. So... I modified  Nikolay Kositsin 's real-time  clock