Hello
I am looking for the way that I can detect the London opening sission ..
How to detect the opening of markets? Could I call then the Hour() function ?
Does the above script detect the opening session correctly? What about the winter timing
- Generating included code - Developing programs
- Opening and Closing Positions - Trade - MetaTrader 5 for iPhone
- Opening and Closing Positions - Trade - MetaTrader 5 for Android
Dear Mohammad,
nope this won't work.
Please read the documentation: https://docs.mql4.com/dateandtime/hour
Hour() returns the last known server time which means that it returns different values for different brokers.
Check the Date and Time possibilities for MQL4 in detail: https://docs.mql4.com/dateandtime
And if you google for GMT and DST codes for mql4 you'll find a bunch of examples.
Best regards
Daniel

What I do, ...
Read server time ...
Add/sustract GMY difference from the EA input external settings ...
By the way, if you search for 1MinuteDaily indicator, you will find ready code there.
So, should i use the TimeGMT() function?
//--- void OnTick() { if ( TimeGMT() == 7 ) .... //London if ( TimeGMT() == 21 ) .... //Tokyo if ( TimeGMT() == 12 ) .... //New York }
But i beleive that there is a *.mqh Library which is managing this kind of programming

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