Download MetaTrader 5

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

To add comments, please log in or register
Willbur
198
Willbur  

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

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

Willbur

aknetmma
53
aknetmma  
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
33346
Alain Verleyen  
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
1405
Doerk Hilger  
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
198
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 :-(

Alain Verleyen
Moderator
33346
Alain Verleyen  
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
198
Willbur  

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
33346
Alain Verleyen  
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