Libraries: Local Timezones and Local Session Hours - page 2

 
cgmuc #:

I think there is still a problem with a one hour difference in V1.62

Would be great if you can have a look into the issue.

Thank you so much. Working on a fix for the next release.

 

Update 30 March 2024 - version 1.65

Fixed broker GMT offset. Currently, the library scans H1 bars only on the GOLD chart as it has the most accurate start times on all brokers that I have tested. (Thanks @cgmuc for detecting the bug on his broker.)

 
amrali #:

Update 30 March 2024 - version 1.65

Fixed broker GMT offset. Currently, the library scans H1 bars only on the GOLD chart as it has the most accurate start times on all brokers that I have tested. (Thanks @cgmuc for detecting the bug on his broker.)

Many thanks for looking into it and the fix.
 

Update 1 April 2024 - version 1.67

Fixed potential issue in the calculation of the broker GMT offset during the first hour of the trading week.

 

Very nicely done, amrali. You've been quite comprehensive. Getting timezones and times correct is crucial to effective trading. You've done a great job for Forex.

One thing I would like to see relates to this thread (in which you kindly pointed me to your work) that seeks to use the stored Session Times in MT5 to determine if the market for any symbol (Forex, Futures, Stocks, etc) is open or closed.

Your code is excellent for Forex, but it would be extremely useful if it were extended to cater for any market being able to be accurately tested for open/closed when testing from any place in any timezone on the globe. If you (or anyone else) knows of code that already does this reliably (as I detailed in the aforementioned thread), I would be grateful to know of it.

Thanks.

DiscussionForumPosting - Schema.org Type
  • schema.org
Schema.org Type: DiscussionForumPosting - A posting to a discussion forum.
 
Jeronymite #:

Very nicely done, amrali. You've been quite comprehensive. Getting timezones and times correct is crucial to effective trading. You've done a great job for Forex.

One thing I would like to see relates to this thread (in which you kindly pointed me to your work) that seeks to use the stored Session Times in MT5 to determine if the market for any symbol (Forex, Futures, Stocks, etc) is open or closed.

Your code is excellent for Forex, but it would be extremely useful if it were extended to cater for any market being able to be accurately tested for open/closed when testing from any place in any timezone on the globe. If you (or anyone else) knows of code that already does this reliably (as I detailed in the aforementioned thread), I would be grateful to know of it.

Thanks.

If you combine amrali library with this code, you should be able to easily determine the actual open and close times of a symbol:

https://www.mql5.com/en/forum/373227/page3#comment_52249679


EDIT:

While thinking about your request, it occurred to me, you might also need to check the EC for holidays, and check if the symbol was moving on that holiday in the previous year. This can be a real challenge for futures, where the contract hasn't existed last year,and thus cannot be checked. And most probably the expired symbol has been removed from the list of symbols, so even if you come up with a way to find the corresponding futures symbol, it might get be already gone. So there would be a substitute required, maybe SP500 is a good choice for that.
 
Jeronymite #:

One thing I would like to see relates to this thread (in which you kindly pointed me to your work) that seeks to use the stored Session Times in MT5 to determine if the market for any symbol (Forex, Futures, Stocks, etc) is open or closed.

Your code is excellent for Forex, but it would be extremely useful if it were extended to cater for any market being able to be accurately tested for open/closed when testing from any place in any timezone on the globe.

Hello,

The scope of my library is Forex trading hours in different local timezones. For other markets (Futures, stocks, etc) the function SymbolInfoSessionTrade will help.

This library Control_Trade_Sessions is based on the above function, it caches the returned session times into array to get some speedups.
 

Update 3 April 2024 - version 1.70

Caching of broker GMT offsets into a hash map for faster retrieval (e.g., from indicators).

The broker offset cache will contain one entry per trading week.

 

Update 8 April 2024 - version 1.72

Improved the performance of the library by at least 2-3x times. Now using StructToTime instead of StringToTime inside the GetNthSunday method.

 

Update 9 April 2024 - version 1.75

Fixed potential issue in the calculation of the broker GMT offset during the Christmas holidays on GMT+0 brokers.


Reason: