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
I have found a different solution.
I want to upload it, but the wheel keeps spinning and spinning...
So here are the indicator and the mqh file.
As the problem seems to be that at OnIni() CopyTime does not provide the values I need - sometimes - I do the time set in OnCalcutalte() (or OnTick()) ...
Feel free to check it and let me know what you think.
Now the new version is online.
I still have an incomprehension, that could be on my side, but if you can enlighten me after reading your guides multiple times without understanding, that would be awesome.
As said, I'm using FTMO, and they switched their DST on NY date (10 March) this year, but when the bot check for DST, instead of moving from +2 to +3 like it would normally do, it did move the GMT from +2 to +4, I'm still really not sure of why it does that. It's not really impactful for now as we're in April/May, but I'd like to understand what happens there.
Taking into consideration that when comes the European DST, it comes back to a more normal number, which is DST +3 (so going from +2 to +3, which is a normal DST switch),
I hope it was understandable. It's quite messy in my head right now, so I tried to make it clear
And as said in my first message, which was telling that I think it's a bug in the code, when I compared a trading hour with trading view putting my trading view time zone to UTC+0, it was off of 1 hour, so I guess that's a coding problem as well. It occurs from 11th of March to 30th of March I think, around that. For the whole NYSumEUWin
Here are the various time states of the MQ-Demo account:
Right now, at 07:24 in Vienna, MEZ (= UTC+2) my time indicator is showing on the chart:
And here are the logs of the debugger of the various time situations at 2024.03.03, 2024.03.10, 2024.03.21, 2024.04.01, 2024.04.11:
2024.04.29 07:06:20.291 2024.03.03 00:00:00 USD-DST for 2024.02.26 03:00 DST: 0 nxtSwitch: Su. 2024.03.10 03:00 USD spr: second 10 Sunday of March: 3
2024.04.29 07:06:20.943 2024.03.03 00:00:00 DST_EUR for 2024.02.26 03:00 DST: 0 nxtSwitch: Su. 2024.03.31 03:00 EUR spr: last 31 Sunday of March: 3
2024.04.29 07:06:21.988 2024.03.03 00:00:00 AUD-DST for 2024.02.26 03:00 DST: -3600 nxtSwitch: Su. 2024.04.07 03:00 AUD spr: first 7 Sunday of April: 4
2024.04.29 07:07:15.377 2024.03.03 00:00:00 Setting broker time offset at: Mo., 2024.02.26 03:00 for MetaQuotes Software Corp.
2024.04.29 07:07:15.377 2024.03.03 00:00:00 Offest (time+diff=GMT): OffsetBroker.actOffset: -7200 sec => GMT: 2024.02.26 01:00 time area: US=Winter & EU=Winter
2024.04.29 07:07:15.377 2024.03.03 00:00:00 get the seconds until FX closes (NY 17:00) with SecTillClose(TimeCurrent()): 421199 sec or 116 h, close time: Fr., 2024.03.01 23:59
2024.04.29 07:07:15.617 2024.03.03 00:00:00
2024.04.29 07:07:15.617 2024.03.03 00:00:00 Offset of MetaQuotes Software Corp.: -2 h = -7200 sec.
2024.04.29 07:07:15.617 2024.03.03 00:00:00 TimeCurrent: Mo. 2024.02.26 03:00:00
2024.04.29 07:07:15.617 2024.03.03 00:00:00 First bar of this week: Su. 2024.02.25 00:00:00
2024.04.29 07:07:15.617 2024.03.03 00:00:00 Last second of this week: Fr. 2024.03.01 23:59:59
2024.04.29 07:07:15.617 2024.03.03 00:00:00 Time left 'till weekend: 421199 s 117.00 h
2024.04.29 07:07:15.617 2024.03.03 00:00:00 Time area: US=Winter & EU=Winter
2024.04.29 07:07:15.617 2024.03.03 00:00:00 Next DST switch US: Su. 2024.03.10 03:00:00
2024.04.29 07:07:15.617 2024.03.03 00:00:00 Next DST switch EU: Su. 2024.03.31 03:00:00
2024.04.29 07:07:15.617 2024.03.03 00:00:00 Next DST switch AU: Su. 2024.04.07 03:00:00
2024.04.29 07:09:59.969 2024.03.10 00:00:00 USD-DST for 2024.03.04 03:00 DST: 0 nxtSwitch: Su. 2024.03.10 03:00 USD spr: second 10 Sunday of March: 3
2024.04.29 07:09:59.969 2024.03.10 00:00:00 DST_EUR for 2024.03.04 03:00 DST: 0 nxtSwitch: Su. 2024.03.31 03:00 EUR spr: last 31 Sunday of March: 3
2024.04.29 07:09:59.969 2024.03.10 00:00:00 AUD-DST for 2024.03.04 03:00 DST: -3600 nxtSwitch: Su. 2024.04.07 03:00 AUD spr: first 7 Sunday of April: 4
2024.04.29 07:09:59.969 2024.03.10 00:00:00 Setting broker time offset at: Mo., 2024.03.04 03:00 for MetaQuotes Software Corp.
2024.04.29 07:09:59.969 2024.03.10 00:00:00 Offest (time+diff=GMT): OffsetBroker.actOffset: -7200 sec => GMT: 2024.03.04 01:00 time area: US=Winter & EU=Winter
2024.04.29 07:09:59.969 2024.03.10 00:00:00 get the seconds until FX closes (NY 17:00) with SecTillClose(TimeCurrent()): 421199 sec or 116 h, close time: Fr., 2024.03.08 23:59
2024.04.29 07:09:59.969 2024.03.10 00:00:00
2024.04.29 07:09:59.969 2024.03.10 00:00:00 Offset of MetaQuotes Software Corp.: -2 h = -7200 sec.
2024.04.29 07:09:59.969 2024.03.10 00:00:00 TimeCurrent: Mo. 2024.03.04 03:00:00
2024.04.29 07:09:59.969 2024.03.10 00:00:00 First bar of this week: Su. 2024.03.03 00:00:00
2024.04.29 07:09:59.969 2024.03.10 00:00:00 Last second of this week: Fr. 2024.03.08 23:59:59
2024.04.29 07:09:59.969 2024.03.10 00:00:00 Time left 'till weekend: 421199 s 117.00 h
2024.04.29 07:09:59.969 2024.03.10 00:00:00 Time area: US=Winter & EU=Winter
2024.04.29 07:09:59.969 2024.03.10 00:00:00 Next DST switch US: Su. 2024.03.10 03:00:00
2024.04.29 07:09:59.969 2024.03.10 00:00:00 Next DST switch EU: Su. 2024.03.31 03:00:00
2024.04.29 07:09:59.969 2024.03.10 00:00:00 Next DST switch AU: Su. 2024.04.07 03:00:00
2024.04.29 07:09:59.982 EURUSD : real ticks begin from 2011.12.19 00:00:00
2024.04.29 07:10:03.535 2024.03.11 00:00:00 USD-DST for 2024.03.11 00:00 DST: -3600 nxtSwitch: Su. 2024.11.03 03:00 USD aut: first 3 Sunday of November: 11
2024.04.29 07:10:03.535 2024.03.11 00:00:00 Setting broker time offset at: Mo., 2024.03.11 00:00 for MetaQuotes Software Corp.
2024.04.29 07:10:03.535 2024.03.11 00:00:00 Offest (time+diff=GMT): OffsetBroker.actOffset: -10800 sec => GMT: 2024.03.10 21:00 time area: US=Summer & EU=Winter
2024.04.29 07:10:03.535 2024.03.11 00:00:00 get the seconds until FX closes (NY 17:00) with SecTillClose(TimeCurrent()): 431999 sec or 119 h, close time: Fr., 2024.03.15 23:59
2024.04.29 07:10:03.535 2024.03.11 00:00:00
2024.04.29 07:10:03.535 2024.03.11 00:00:00 Offset of MetaQuotes Software Corp.: -3 h = -10800 sec.
2024.04.29 07:10:03.535 2024.03.11 00:00:00 TimeCurrent: Mo. 2024.03.11 00:00:00
2024.04.29 07:10:03.535 2024.03.11 00:00:00 First bar of this week: Su. 2024.03.10 00:00:00
2024.04.29 07:10:03.535 2024.03.11 00:00:00 Last second of this week: Fr. 2024.03.15 23:59:59
2024.04.29 07:10:03.535 2024.03.11 00:00:00 Time left 'till weekend: 431999 s 120.00 h
2024.04.29 07:10:03.535 2024.03.11 00:00:00 Time area: US=Summer & EU=Winter
2024.04.29 07:10:03.535 2024.03.11 00:00:00 Next DST switch US: Su. 2024.11.03 03:00:00
2024.04.29 07:10:03.535 2024.03.11 00:00:00 Next DST switch EU: Su. 2024.03.31 03:00:00
2024.04.29 07:10:03.535 2024.03.11 00:00:00 Next DST switch AU: Su. 2024.04.07 03:00:00
2024.04.29 07:11:18.900 2024.03.21 00:00:00 USD-DST for 2024.03.21 00:00 DST: -3600 nxtSwitch: Su. 2024.11.03 03:00 USD aut: first 3 Sunday of November: 11
2024.04.29 07:11:18.900 2024.03.21 00:00:00 DST_EUR for 2024.03.21 00:00 DST: 0 nxtSwitch: Su. 2024.03.31 03:00 EUR spr: last 31 Sunday of March: 3
2024.04.29 07:11:18.900 2024.03.21 00:00:00 AUD-DST for 2024.03.21 00:00 DST: -3600 nxtSwitch: Su. 2024.04.07 03:00 AUD spr: first 7 Sunday of April: 4
2024.04.29 07:11:18.900 2024.03.21 00:00:00 Setting broker time offset at: Th., 2024.03.21 00:00 for MetaQuotes Software Corp.
2024.04.29 07:11:18.900 2024.03.21 00:00:00 Offest (time+diff=GMT): OffsetBroker.actOffset: -10800 sec => GMT: 2024.03.20 21:00 time area: US=Summer & EU=Winter
2024.04.29 07:11:18.900 2024.03.21 00:00:00 get the seconds until FX closes (NY 17:00) with SecTillClose(TimeCurrent()): 172799 sec or 47 h, close time: Fr., 2024.03.22 23:59
2024.04.29 07:11:18.900 2024.03.21 00:00:00
2024.04.29 07:11:18.900 2024.03.21 00:00:00 Offset of MetaQuotes Software Corp.: -3 h = -10800 sec.
2024.04.29 07:11:18.900 2024.03.21 00:00:00 TimeCurrent: Th. 2024.03.21 00:00:00
2024.04.29 07:11:18.900 2024.03.21 00:00:00 First bar of this week: Su. 2024.03.17 00:00:00
2024.04.29 07:11:18.900 2024.03.21 00:00:00 Last second of this week: Fr. 2024.03.22 23:59:59
2024.04.29 07:11:18.900 2024.03.21 00:00:00 Time left 'till weekend: 172799 s 48.00 h
2024.04.29 07:11:18.900 2024.03.21 00:00:00 Time area: US=Summer & EU=Winter
2024.04.29 07:11:18.900 2024.03.21 00:00:00 Next DST switch US: Su. 2024.11.03 03:00:00
2024.04.29 07:11:18.900 2024.03.21 00:00:00 Next DST switch EU: Su. 2024.03.31 03:00:00
2024.04.29 07:11:18.900 2024.03.21 00:00:00 Next DST switch AU: Su. 2024.04.07 03:00:00
2024.04.29 07:11:19.156 EURUSD : real ticks begin from 2011.12.19 00:00:00
2024.04.29 07:12:25.502 2024.04.01 00:00:00 USD-DST for 2024.03.25 02:00 DST: -3600 nxtSwitch: Su. 2024.11.03 03:00 USD aut: first 3 Sunday of November: 11
2024.04.29 07:12:25.502 2024.04.01 00:00:00 DST_EUR for 2024.03.25 02:00 DST: 0 nxtSwitch: Su. 2024.03.31 03:00 EUR spr: last 31 Sunday of March: 3
2024.04.29 07:12:25.502 2024.04.01 00:00:00 AUD-DST for 2024.03.25 02:00 DST: -3600 nxtSwitch: Su. 2024.04.07 03:00 AUD spr: first 7 Sunday of April: 4
2024.04.29 07:12:25.502 2024.04.01 00:00:00 Setting broker time offset at: Mo., 2024.03.25 02:00 for MetaQuotes Software Corp.
2024.04.29 07:12:25.502 2024.04.01 00:00:00 Offest (time+diff=GMT): OffsetBroker.actOffset: -10800 sec => GMT: 2024.03.24 23:00 time area: US=Summer & EU=Winter
2024.04.29 07:12:25.502 2024.04.01 00:00:00 get the seconds until FX closes (NY 17:00) with SecTillClose(TimeCurrent()): 424799 sec or 117 h, close time: Fr., 2024.03.29 23:59
2024.04.29 07:12:25.502 2024.04.01 00:00:00
2024.04.29 07:12:25.502 2024.04.01 00:00:00 Offset of MetaQuotes Software Corp.: -3 h = -10800 sec.
2024.04.29 07:12:25.502 2024.04.01 00:00:00 TimeCurrent: Mo. 2024.03.25 02:00:00
2024.04.29 07:12:25.502 2024.04.01 00:00:00 First bar of this week: Su. 2024.03.24 00:00:00
2024.04.29 07:12:25.502 2024.04.01 00:00:00 Last second of this week: Fr. 2024.03.29 23:59:59
2024.04.29 07:12:25.502 2024.04.01 00:00:00 Time left 'till weekend: 424799 s 118.00 h
2024.04.29 07:12:25.502 2024.04.01 00:00:00 Time area: US=Summer & EU=Winter
2024.04.29 07:12:25.502 2024.04.01 00:00:00 Next DST switch US: Su. 2024.11.03 03:00:00
2024.04.29 07:12:25.502 2024.04.01 00:00:00 Next DST switch EU: Su. 2024.03.31 03:00:00
2024.04.29 07:12:25.502 2024.04.01 00:00:00 Next DST switch AU: Su. 2024.04.07 03:00:00
2024.04.29 07:12:25.700 EURUSD : real ticks begin from 2011.12.19 00:00:00
2024.04.29 07:12:29.570 2024.04.01 00:00:01 DST_EUR for 2024.04.01 00:00 DST: -3600 nxtSwitch: Su. 2024.10.27 03:00 EUR aut: last 27 Sunday of October: 10
2024.04.29 07:12:29.570 2024.04.01 00:00:01 Setting broker time offset at: Mo., 2024.04.01 00:00 for MetaQuotes Software Corp.
2024.04.29 07:12:29.570 2024.04.01 00:00:01 Offest (time+diff=GMT): OffsetBroker.actOffset: -10800 sec => GMT: 2024.03.31 21:00 time area: US=Summer & EU=Summer
2024.04.29 07:12:29.570 2024.04.01 00:00:01 get the seconds until FX closes (NY 17:00) with SecTillClose(TimeCurrent()): 431998 sec or 119 h, close time: Fr., 2024.04.05 23:59
2024.04.29 07:12:29.570 2024.04.01 00:00:01
2024.04.29 07:12:29.570 2024.04.01 00:00:01 Offset of MetaQuotes Software Corp.: -3 h = -10800 sec.
2024.04.29 07:12:29.570 2024.04.01 00:00:01 TimeCurrent: Mo. 2024.04.01 00:00:01
2024.04.29 07:12:29.570 2024.04.01 00:00:01 First bar of this week: Su. 2024.03.31 00:00:00
2024.04.29 07:12:29.570 2024.04.01 00:00:01 Last second of this week: Fr. 2024.04.05 23:59:59
2024.04.29 07:12:29.570 2024.04.01 00:00:01 Time left 'till weekend: 431998 s 120.00 h
2024.04.29 07:12:29.570 2024.04.01 00:00:01 Time area: US=Summer & EU=Summer
2024.04.29 07:12:29.570 2024.04.01 00:00:01 Next DST switch US: Su. 2024.11.03 03:00:00
2024.04.29 07:12:29.570 2024.04.01 00:00:01 Next DST switch EU: Su. 2024.10.27 03:00:00
2024.04.29 07:12:29.570 2024.04.01 00:00:01 Next DST switch AU: Su. 2024.04.07 03:00:00
2024.04.29 07:13:09.913 2024.04.11 00:00:00 USD-DST for 2024.04.11 00:00 DST: -3600 nxtSwitch: Su. 2024.11.03 03:00 USD aut: first 3 Sunday of November: 11
2024.04.29 07:13:09.913 2024.04.11 00:00:00 DST_EUR for 2024.04.11 00:00 DST: -3600 nxtSwitch: Su. 2024.10.27 03:00 EUR aut: last 27 Sunday of October: 10
2024.04.29 07:13:09.913 2024.04.11 00:00:00 AUD-DST for 2024.04.11 00:00 DST: 0 nxtSwitch: Su. 2024.10.06 03:00 AUD aut: first 6 Sunday of October: 10
2024.04.29 07:13:09.913 2024.04.11 00:00:00 Setting broker time offset at: Th., 2024.04.11 00:00 for MetaQuotes Software Corp.
2024.04.29 07:13:09.913 2024.04.11 00:00:00 Offest (time+diff=GMT): OffsetBroker.actOffset: -10800 sec => GMT: 2024.04.10 21:00 time area: US=Summer & EU=Summer
2024.04.29 07:13:09.913 2024.04.11 00:00:00 get the seconds until FX closes (NY 17:00) with SecTillClose(TimeCurrent()): 172799 sec or 47 h, close time: Fr., 2024.04.12 23:59
2024.04.29 07:13:09.913 2024.04.11 00:00:00
2024.04.29 07:13:09.913 2024.04.11 00:00:00 Offset of MetaQuotes Software Corp.: -3 h = -10800 sec.
2024.04.29 07:13:09.913 2024.04.11 00:00:00 TimeCurrent: Th. 2024.04.11 00:00:00
2024.04.29 07:13:09.913 2024.04.11 00:00:00 First bar of this week: Su. 2024.04.07 00:00:00
2024.04.29 07:13:09.913 2024.04.11 00:00:00 Last second of this week: Fr. 2024.04.12 23:59:59
2024.04.29 07:13:09.913 2024.04.11 00:00:00 Time left 'till weekend: 172799 s 48.00 h
2024.04.29 07:13:09.913 2024.04.11 00:00:00 Time area: US=Summer & EU=Summer
2024.04.29 07:13:09.913 2024.04.11 00:00:00 Next DST switch US: Su. 2024.11.03 03:00:00
2024.04.29 07:13:09.913 2024.04.11 00:00:00 Next DST switch EU: Su. 2024.10.27 03:00:00
2024.04.29 07:13:09.913 2024.04.11 00:00:00 Next DST switch AU: Su. 2024.10.06 03:00:00
2024.04.29 07:13:10.043 EURUSD : real ticks begin from 2011.12.19 00:00:00
I can't see any error.
It seems to be working on Saturday, Sunday and Monday as well now, even on my side so that's perfect.
I still have an incomprehension, that could be on my side, but if you can enlighten me after reading your guides multiple times without understanding, that would be awesome.
As said, I'm using FTMO, and they switched their DST on NY date (10 March) this year, but when the bot check for DST, instead of moving from +2 to +3 like it would normally do, it did move the GMT from +2 to +4, I'm still really not sure of why it does that. It's not really impactful for now as we're in April/May, but I'd like to understand what happens there.
Taking into consideration that when comes the European DST, it comes back to a more normal number, which is DST +3 (so going from +2 to +3, which is a normal DST switch),
I hope it was understandable. It's quite messy in my head right now, so I tried to make it clear
And as said in my first message, which was telling that I think it's a bug in the code, when I compared a trading hour with trading view putting my trading view time zone to UTC+0, it was off of 1 hour, so I guess that's a coding problem as well. It occurs from 11th of March to 30th of March I think, around that. For the whole NYSumEUWin
Try this lib on yoor broker to check if it is a broker problem. https://www.mql5.com/en/code/48291
Try this lib on yoor broker to check if it is a broker problem. https://www.mql5.com/en/code/48291
Indeed it looks like that's a broker problem, I'm not sure of where I could check to try solving that issue, that's not going to interfere a lot with my bot, but that's still quite a problem, thanks for the help on that!
See here: https://www.mql5.com/ru/forum/1111/page3519#comment_53211917
See here: https://www.mql5.com/ru/forum/1111/page3519#comment_53211917
By doing that, when I put the library on my expert advisor, and I know that the broker has that issue we've spoken about, I can just add this in the inputs of my EA :
input bool brokerWinToSumProblem = false; // If your broker has a DST problem in March
And then in the init function I just need to change "isTimeSet" :
bool isTimeSet = setBokerOffset( brokerWinToSumProblem );
Tell me what you think about it, it's really barbarian way of doing it, but it seems to be working so I won't complain :)
I really don't think it's the right way of going with it, but I've made a little change to the library to adapt the offset for when the broker decides to switch with NY DST when they use London times, from my understanding, it happens only in March so I did not try to do anything for October (the other dst switch I think).
By doing that, when I put the library on my expert advisor, and I know that the broker has that issue we've spoken about, I can just add this in the inputs of my EA :
input bool brokerWinToSumProblem = false; // If your broker has a DST problem in March
And then in the init function I just need to change "isTimeSet" :
bool isTimeSet = setBokerOffset( brokerWinToSumProblem );
Tell me what you think about it, it's really barbarian way of doing it, but it seems to be working so I won't complain :)
I'll program tomorrow a solution for such sluggard broker.
I'll program tomorrow a solution for such sluggard broker.
Hi @Carl Schreiber
There used to be methods to find First Bar and Last Bar of the day, do they still exist somewhere in your lib(s)? If true please share the link.
I remembered one of your post stating that they no longer works with updated Mql5 version, but not sure about it.