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

 
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);
 
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.

 
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.

 

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 :-(

 
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 ?
 

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
 
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);

Reason: