How to find the Friday's market closing time?

To add comments, please log in or register
Miroslav Popov
435
Miroslav Popov  

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));
Stanislav Korotky
31575
Stanislav Korotky  
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.
honest_knave
Moderator
2308
honest_knave  

Out of interest, what does it show under Sessions when you right-click the instrument in Market Watch and select "Specification"?

honest_knave
Moderator
2308
honest_knave  

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

Your script running:

 

honest_knave
Moderator
2308
honest_knave  

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

 

Alain Verleyen
38980
Alain Verleyen  
Miroslav Popov:
...
Please watch your language.
Alain Verleyen
38980
Alain Verleyen  
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 (?).
honest_knave
Moderator
2308
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.
Alain Verleyen
38980
Alain Verleyen  
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.

Alain Verleyen
38980
Alain Verleyen  
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.
Miroslav Popov
435
Miroslav Popov  

Alain,

Please delete this topic. Nothing useful comes here. 

12
To add comments, please log in or register