First you should use TimeToStruct function instead of straightforward division (the doc says "in the returned value date should be ignored", but you can potentially get a number of hours since epoch). Did you try SymbolInfoSessionQuote? As a workaround you can lookup history of quotes.
Out of interest, what does it show under Sessions when you right-click the instrument in Market Watch and select "Specification"?
Miroslav Popov:
...
Please watch your language.
...
honest_knave:
Mine too. Miroslav is most probably using an other server (?).
Oddly, I too am using the demo from the MetaQuotes website but EURUSD runs up to midnight
It would be interesting to know if this is a bug in SymbolInfoSessionTrade, or simply the server not having the correct settings. I'm more inclined to think it is the latter.
Miroslav Popov:
You are right. It shows session from 00:00 to 24:00.
However the market close at 22:00.
If the data are from 00:00 to 24:00 you can't have 22:00 as result.
If you are using MT5 Metaquotes-Demo Server and you have only data up to 2016.12.16 21:45 there is something strange.
honest_knave:
It would be interesting to know if this is a bug in SymbolInfoSessionTrade, or simply the server not having the correct settings. I'm more inclined to think it is the latter.
What bug ? What is the problem actually ? There is not.
It would be interesting to know if this is a bug in SymbolInfoSessionTrade, or simply the server not having the correct settings. I'm more inclined to think it is the latter.
Alain,
Please delete this topic. Nothing useful comes here.
![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,
I want to find at what hour the market closes on Friday.
I'm trying with the following script but it returns 0. However the market closes at 22:00.
How can fix the script in order to make it showing 22?
datetime closeTime;
bool isOk=SymbolInfoSessionTrade(_Symbol,FRIDAY,0,openTime,closeTime);
int closeHour = (int)(closeTime/3600);
Print("Friday close hour: "+IntegerToString(closeHour));