Marbo: is there an easy way to convert any timestamp from MT4 time to local time?
-
There is no such thing as “MT4 time”. Chart are broker's time.
-
Round the offset of server to local time to the nearest half hour:
double MathNearest( double aV, double aM){ return aM * MathRound(aV/aM); } double MathRoundDown(double aV, double aM){ return aM * MathFloor(aV/aM); } double MathRoundUp( double aV, double aM){ return aM * MathCeil( aV/aM); } int gLocalToServer = (int)MathNearest(TimeCurrent() - TimeLocal(), 1800); datetime serverTime = TimeLocal() + gLocalToServer; datetime localTime = TimeCurrent() - gLocalToServer;
how can i detect that 10 seconds to bar close? MT4/EA - MQL5 programming forum 2020.04.24
Indicators: Zero Lag Timer - Indices - Articles, Library comments - MQL5 programming forum -
That will not work across DST changes.
William Roeder:
-
There is no such thing as “MT4 time”. Chart are broker's time.
-
Round the offset of server to local time to the nearest half hour:
how can i detect that 10 seconds to bar close? MT4/EA - MQL5 programming forum 2020.04.24
Indicators: Zero Lag Timer - Indices - Articles, Library comments - MQL5 programming forum -
That will not work across DST changes.
Thank you!
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hello,
is there an easy way to convert any timestamp from MT4 time to local time?
Something like TimeLocal(Time[5])?
I tried it with TimeGMTOffset(), TimeDaylightSavings() and some other things but it doesn't really work..
Any help is very appreciated.