How to find the Friday's market closing time?

 

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 openTime;
   datetime closeTime;

   bool isOk=SymbolInfoSessionTrade(_Symbol,FRIDAY,0,openTime,closeTime);

   int closeHour = (int)(closeTime/3600);

   Print("Friday close hour: "+IntegerToString(closeHour));
 
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"?

 

Yes, but what does it say under Sessions in Specification? Does it match what you are getting? 

Your script running:

 

 

Oddly, I too am using the demo from the MetaQuotes website but EURUSD runs up to midnight

 

 
Miroslav Popov:
...
Please watch your language.
 
honest_knave:

Oddly, I too am using the demo from the MetaQuotes website but EURUSD runs up to midnight

 

Mine too. Miroslav is most probably using an other server (?).
 
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.
 

Alain,

Please delete this topic. Nothing useful comes here. 

Reason: