Scripts: Function for checking whether the market is open for trading at the moment by the current symbol

 

Function for checking whether the market is open for trading at the moment by the current symbol:

The function can be useful to not overload the server with trade requests at times when the market is closed for trading

Author: Anton Iaroshenko

 
It has trouble with some odd SPECIFICATION like:
Sunday Session 0: 22:00 to 22:00
Monday Session 0: 22:00 to 22:00
Tuesday Session 0: 22:00 to 22:00
Wednesday Session 0: 22:00 to 22:00
Thursday Session 0: 22:00 to 22:00

This SPEC exists in brokers' server setup.