You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I have one more bug that I've come across. Not sure if it is only on Sundays (which is usually when get some time to code and troubleshoot), but my broker (Active Trades) seems to be detected as a Timezone of GMT-21 which is incorrect (should be GMT+1). Any idea what could be causing this? I am using BTCUSD pair so it is trading on Sundays.
In my code, I pass a candle datetime and from there try to determine whether the sessions was open at that time (i.e. I need to be able to throw any candle at it and it should tell me whether it was printed during the session, with weekends always being closed), so I am doing this:
Thanks
Hi,
I have one more bug that I've come across. Not sure if it is only on Sundays (which is usually when get some time to code and troubleshoot), but my broker (Active Trades) seems to be detected as a Timezone of GMT-21 which is incorrect (should be GMT+1). Any idea what could be causing this? I am using BTCUSD pair so it is trading on Sundays.
In my code, I pass a candle datetime and from there try to determine whether the sessions was open at that time (i.e. I need to be able to throw any candle at it and it should tell me whether it was printed during the session, with weekends always being closed), so I am doing this:
Thanks
Hi @amrali.
Great work on all your libraries (upvote from me)!
I have a minor issue and perhaps you could point me out to the correct library (or function) if I haven't seen it.
I am located at UTC+3 DST (Athens time zone or Cyprus). I run the BrokerDaylightSchedule.mq5 and I get the following for the Nasdaq symbol:
Server : PepperstoneUK-Demo
Time : 2025.05.17 16:22:46
Offset : GMT+3
DST_US : server dst begins on the second Sunday of March (+1) and ends on the first Sunday of November (-1)
Nasdaq opens always at 16:30 at my time zone except for a couple of weeks where NY has switched to DST but Athens hasn't. In this case Nasdaq opens at 15:30 my local (Greek) time but Metatrader still displays 16:30 (since it switches DST on US times). As such, there is no problem with my experts since they always know that Nasdaq bar with time 16:30 is the first one of the market open.
The problem arrives when I want to make my expert run on FTSE (UK time zone). FTSE opens at 10:00 local time but when US enters DST and UK hasn't entered it yet, the open bar at Metatrader arrives at 11:00 (for almost 2-3 weeks until UK switches to DST). How do you handle that issue? Do you have any ready made library to handle these kind of issues or you do it manually, eg pseudocode below:
Thanks in advance!
The problem arrives when I want to make my expert run on FTSE (UK time zone). FTSE opens at 10:00 local time but when US enters DST and UK hasn't entered it yet, the open bar at Metatrader arrives at 11:00 (for almost 2-3 weeks until UK switches to DST). How do you handle that issue? Do you have any ready made library to handle these kind of issues or you do it manually, eg pseudocode below:
It is better to use a session object to handle dst changes behind the scenes and to focus on the task at hand. (The lib objects will take care of UTC/DST discrepancies between your server's and London time "FTSE").
Example output on my broker (ICMarkets GMT+3):
It is better to use a session object to handle dst changes behind the scenes and to focus on the task at hand. (The lib objects will take care of UTC/DST discrepancies between your server's and London time "FTSE").
Example output on my broker (ICMarkets GMT+3):
Thank you very much!
Thank you very much!
To trade the FTSE session in your EA, the above code can be rearranged into something like this:
Hi @amrali.
I am trying to find some error in the `CTimeZoneInfo` class. Running the following on history data (debugging):
I get different outputs from the app (especially in the TimeLocal and broker time).
The below is the same exact options to the above...
The options are:
Observe something. None of the 2 runs have a TimeLocal() of 2025.01.01 or at least the first next working day after new year.
Also, I observed that the TimeLocal() returns constantly different time but it is around 5 hours difference every time it is run (I don't know if it does have to do anything).
Finally, I have one more question if you can answer. Inside the `HistoryServerDaylightSavings` you have the following code:
Can't this be replaced to something like:
You use that 'if' statement on the `HistoryServerGMTOffset` method and it is more simple than calling the `IsDaylightSavingsTime(...)` method which repeatedly instantiates a new `CTimeZoneInfo` class and then re-calls the `SetLocalTime` method resulting in big call stack (from the recursion).
Maybe it could be simplified or am I missing something?
Thanks for the hard work! You have developed a truly amazing library!
I am trying to find some error in the `CTimeZoneInfo` class. Running the following on history data (debugging):
I get different outputs from the app (especially in the TimeLocal and broker time).
The below is the same exact options to the above...
Just a guess: try to disable the visual mode and/or choose real ticks.