capilta: what GMT Shirt use Broker in MT4. or is there any function to EA know auto what is the GMT using broker? |
|
capilta: what GMT Shirt use Broker in MT4. or is there any function to EA know auto what is the GMT using broker? |
|
WHRoeder: "GMT Shirt use Broker" is probable only a typo as r and f (=> GMT Shift use Broker) are next to each other on the keyboard.
capilta: Mt4 provides TimeCurrent() (=server time) and TimeGMT (since b600) which is your local pc-GMT. So if you calc: TimeCurrent()-TimeGMT() you'll have:
the broker-GMT-ShiFt inclusive 1) their DST and 2) the latency due to the the remote MT4-server and the internet and 3) the time difference of your pc-GMT to the 'real' GMT.
So you need to round to full halve hours: datetime shift = (datetime)(TimeHour(TimeCurrent() - TimeGMT() + 600)*3600); // UNTESTED!!
And this works only(!!) if the markets aren't closed!! Otherwise you'll get ridiculous numbers!
You'd better calc this difference every Sunday night after the market has opened as USA, EU and Australia do have different weekends when they change their DST. And if you back test the DST becomes more gormless as it has been changed several times :(
Gooly
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear Guys,
is there any function in MQL to know what GMT Shirt use Broker in MT4. or is there any function to EA know auto what is the GMT using broker?
Thanks in Advanced