How can I find the timezone that my broker resides in?
I can get the time of the last tick using something like:
That tells me the time of the tick, but not the time zone.
I've looked at various AccountInfo, MarketInfo and SymbolInfo
functions, but I can't find anything that simply tells the timezone that the broker resides in.
Take your guess
Take your guess
As I said in the title of the my post, I'm using MQL4... not 5.
Secondly, I already did RTFM... just not every single last letter of
it.
Since I checked everything that seemed obvious, asking a knowledgable body of more experienced people seemed like a good idea.
Also, none of those time functions help, because they are all based on modified Unix epocs. They don't store any information about time zone.
They modify the epoc internally somehow, then don't store the timezone ( atleast not anywhere that I can find ).
So yeah, I could try to figure out the time zone by comparing it to TimeGMT() and hoping for the best... but daylight savings ruins that idea.
Some places observe DST, some don't. Different places may observe it at different times and possibly even in different amounts.
It would be pretty cool if MT4 could just tell me the time zone so that I wouldn't have to guess.
As I said in the title of the my post, I'm using MQL4... not 5.
Secondly, I already did read the documentation... just not every single last letter of it.
Since I checked everything that seemed obvious, asking a knowledgeable body of more experienced people seemed like a good idea.
I don't know what answer you are expecting.
TimeGMTOffset() |
will give you the local time offset from GMT.
Many people (me included) will click on unread posts and the title does not always register so please include important information in your posts, not just the title.
If the subject is regarding MQL4 then please post the topic in the MQL4 sub-forum.
If I had noticed this before I would already have moved this topic.
I will move it now.
According to the MQL4 manual at: https://docs.mql4.com/dateandtime/timegmtoffset
TimeGMTOffset() = TimeGMT() - TimeLocal()
Which means it tells you nothing about the broker. It just telling the difference between your local machine and GMT.
So I'm still not able to find anything that tells the difference between GMT and the broker.
I'm hoping that there is a way to do this. I'd rather not have to do it manually then hope for the best come DST.
- docs.mql4.com
Ok, thanks for the info... sorry for posting in the wrong place.
According to the MQL4 manual at: https://docs.mql4.com/dateandtime/timegmtoffset
TimeGMTOffset() = TimeGMT() - TimeLocal()
Which means it tells you nothing about the broker. It just telling the difference between your local machine and GMT.
So I'm still not able to find anything that tells the difference between GMT and the broker.
I'm hoping that there is a way to do this. I'd rather not have to do it manually then hope for the best come DST.
Sorry, typo.
You know the difference between your local time and GMT and you can use the difference between TimeLocal() and your broker's time to calculate the GMT offset.
You have to ask them. Comparing to UTC doesn't tell you anything about DST.
- FX opens 5pm Eastern Time (NY) Sunday and ends 5pm NY Friday. Some brokers start after (6pm is common/end before (up to 15 minutes)
due to low volatility.
Checking for Market Closed - Expert Advisors and MQL5 programming forum Trading - MQL5 programming forum
Swap is computed 5pm ET. No swap if no open orders at that time. -
Brokers use a variety of timezones. Their local time (with or without DST,) GMT/UTC, GMT+2, NY+7.
Only with NY+7 does the broker's 00:00 equals 5pm ET and the start of a daily bar (and H4) is the start of a new FX day.
GMT brokers, means there is a 1 or 2 hour D1/H4 bar on Sunday (depending on NY DST,) and a short Friday bar.
GMT+2 is close but doesn't adjust for NY DST.
EET is closer except when their DST doesn't match NY's. Last Sunday of March and 1:00 on the last Sunday of October vs second Sunday in March and return at 2:00 a.m. EDT to 1:00 a.m. EST on the first Sunday in November.
-
Non-NY+7, means the chart daily bar overlaps the start, and converting broker time to NY time requires broker to GMT to NY timezone conversions.
- If you search the web you will find differing answers. Those are all wrong (half the year) because they do not take DST into account
(or that it changed in 2007 [important when testing history.])
- Then there are H4 candles that start on odd hours.
Why My XAUUSD 4H candles start with 1 hour shift? - Currency Pairs - General - MQL5 programming forum
Ok, thanks for the info... sorry for posting in the wrong place.
According to the MQL4 manual at: https://docs.mql4.com/dateandtime/timegmtoffset
TimeGMTOffset() = TimeGMT() - TimeLocal()
Which means it tells you nothing about the broker. It just telling the difference between your local machine and GMT.
So I'm still not able to find anything that tells the difference between GMT and the broker.
I'm hoping that there is a way to do this. I'd rather not have to do it manually then hope for the best come DST.
int brokerGMT = TimeHour((TimeCurrent()-TimeGMT()));
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
How can I find the timezone that my broker resides in?
I can get the time of the last tick using something like:
That tells me the time of the tick, but not the time zone.
I've looked at various AccountInfo, MarketInfo and SymbolInfo functions, but I can't find anything that simply tells the timezone that the broker resides in.