Download MetaTrader 5
To add comments, please log in or register
Download documentation as one file. It is easy!
Willbur
193
Willbur 2016.05.05 08:52 

Does anybody know how to get the market's opening time?

I checked SYMBOL_INFO_STRING() but can't find it.

Willbur

aknetmma
45
aknetmma 2016.05.05 09:51  
I use something like this:

MqlDateTime open, close;
datetime openDT, closeDT;
bool sessionTrade = SymbolInfoSessionTrade("EURUSD", MONDAY, 0, openDT, closeDT);
TimeToStruct(openDT, open);
TimeToStruct(closeDT, close);

PrintFormat("Opening Time(%d) ", open.hour);
Alain Verleyen
Moderator
28672
Alain Verleyen 2016.05.05 10:31  
aknetmma:
I use something like this:

From my experience this approaches is not reliable, as  it depends of the broker. The data about trading sessions are not provided by all brokers.

Of course, it depends of your goal, if you are using 1 broker and the data are available, then that's fine.

By the way, if the market in question is Forex, that's not difficult to know the opening/closing time, it's always the same.

Doerk Hilger
1074
Doerk Hilger 2016.05.05 10:51  
Alain Verleyen:

From my experience this approaches is not reliable, as  it depends of the broker. The data about trading sessions are not provided by all brokers.

Of course, it depends of your goal, if you are using 1 broker and the data are available, then that's fine.

By the way, if the market in question is Forex, that's not difficult to know the opening/closing time, it's always the same.

except on some days before holidays.

Safest way to figure out the times is to loop backwards through the candles/ticks on a lower timeframe and compare the date values.

Willbur
193
Willbur 2016.05.05 11:32  

Thanks for you ideas. 

You can find the regular trading times in MT5 / Menu / View / Symbol   or simple  Ctrl+U.

All the other information which are provided here are avaliable in SYMBOL_INFO_xxxxx().

That was the reason for my question.


Of couse this are only the regular times.

Today I spend half an hour waiting for the SMI opening.  Bank holiday :-(

Alain Verleyen
Moderator
28672
Alain Verleyen 2016.05.05 12:33  
Willbur:

Thanks for you ideas. 

You can find the regular trading times in MT5 / Menu / View / Symbol   or simple  Ctrl+U.

All the other information which are provided here are avaliable in SYMBOL_INFO_xxxxx().

That was the reason for my question.


Of couse this are only the regular times.

Today I spend half an hour waiting for the SMI opening.  Bank holiday :-(

So ? It was possible to get the information about SMI opening from SymbolXXX() functions or not ?
Willbur
193
Willbur 2016.05.06 11:13  

Today I spend half an hour waiting for the SMI opening.  Bank holiday :-(

I sat in front of the screen and have been waiting for the chart to do the first move.

Back to my question:

One can get this screen by pressing Ctrl+U.


In fact, you can read here that in Switzerland was no trading this Thursday.

Which means, this are not only the regular times. This are the current times!

My question was: How can I read this information from my EA?

Willbur
Alain Verleyen
Moderator
28672
Alain Verleyen 2016.05.06 11:47  
Willbur:

I sat in front of the screen and have been waiting for the chart to do the first move.

Back to my question:

One can get this screen by pressing Ctrl+U.


In fact, you can read here that in Switzerland was no trading this Thursday.

Which means, this are not only the regular times. This are the current times!

My question was: How can I read this information from my EA?

Willbur

Isn't already answered above ?

Forum on trading, automated trading systems and testing trading strategies

market's opening / closing time - SYMBOL_INFO_STRING() ?

aknetmma, 2016.05.05 09:51

I use something like this:

MqlDateTime open, close;
datetime openDT, closeDT;
bool sessionTrade = SymbolInfoSessionTrade("EURUSD", MONDAY, 0, openDT, closeDT);
TimeToStruct(openDT, open);
TimeToStruct(closeDT, close);

PrintFormat("Opening Time(%d) ", open.hour);

/
To add comments, please log in or register