I don't know how that function works, but it looks like the documentation should partially answer your question.
- docs.mql4.com
AI Chatbot A :-
It said that the DLSSec is applying to and following the broker's server time to adjust, it means that :-
AI Chatbot B :-
It said that the DLSSec is applying to and following the user's computer local time and my host country in Asia has no DLS, therefore :-
It depends on the time settings of your computer.
I don't know. But from the documentation it is clear that the function follows the local time of the computer, not the server time. That's what I was trying to tell you.
So, you mean in my country (Asia), we do not have DLS, means the DLSSEc output is always 0 throughout the entire year ?
So, you mean in my country (Asia), we do not have DLS, means the DLSSEc output is always 0 throughout the entire year ?
Yes, because there is no summer switch.
I suspect that the missing piece of the puzzle that you're trying to solve is TImeGMTOffset().
GMT adjusts for Daylight Savings, your computer does not, and TimeGMTOffset() calculates the difference between the two. So, you can write something like...
// globals int lastOffset; // initialization lastOffset = TimeGMTOffset(); // main event handler //... if(lastOffset == TimeGMTOffset() - 3600) { // do something lastOffset = TimeGMTOffset(); } if(lastOffset == TimeGMTOffset() + 3600) { // do something lastOffset = TimeGMTOffset(); }
Just a note: Time is technically a ulong in MQL5 even though an int works. If the same is true for MQL4, you might want to use a ulong to be technically correct.
- docs.mql4.com
- docs.mql4.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi coders,
int DLSSec= TimeDaylightSavings();
I'm a trader in Asia country, the forex market open local time is either 06:00 or 05:00 daily (broker's server time = 00:00). It is in winter period right now, the DLSSEc output = 0 and the forex market open local time is at 06:00.
I checked with 2 AI chatbots, both are giving me totally opposite answers on DLSSec.
AI Chatbot A :-
It said that the DLSSec is applying to and following the broker's server time to adjust, it means that :-
1) if the market open local time is at 06:00 (winter period) and the DLSSEc output = 0.
2) if the market open local time is at 05:00 (summer period) and the DLSSEc output = 3600 (1 hour).
AI Chatbot B :-
It said that the DLSSec is applying to and following the user's computer local time and my host country in Asia has no DLS, therefore :-
1) if the market open local time is at 06:00 (winter period) and the DLSSEc output = 0.
2) if the market open local time is at 05:00 (summer period) and the DLSSEc output = 0.
In other words, DLSSEc output is always 0 throughout the entire year.
Which is the correct answer ? Kindly advise, thanks