Download MetaTrader 5

Simple test to determine if market is closed?

To add comments, please log in or register
Publish the program in the Market and sell it to millions of traders!
Ingvar Engelbrecht
4504
Ingvar Engelbrecht 2013.10.27 17:50 
I know I can check the hours but is there a simple test that can be done to determine if the market is open or closed?
Sergey Golubev
Moderator
93817
Sergey Golubev 2013.10.28 08:28  
You can not open the trade because market is close
Alain Verleyen
Moderator
30775
Alain Verleyen 2013.10.28 09:29  
ingvar_e:
I know I can check the hours but is there a simple test that can be done to determine if the market is open or closed?
In which context ?
Ingvar Engelbrecht
4504
Ingvar Engelbrecht 2013.10.28 17:09  
angevoyageur:
In which context ?

  context?

  I just want to avoid placing trades or modify running orders when the market is closed in order not to mess up the log. It is an EA running 24/7

Just thought a little more about it and decided that it will work if I confine myself to do order type commands in the "start" routine. No ticks coming from a closed market

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
Alain Verleyen
Moderator
30775
Alain Verleyen 2013.10.28 17:58  
ingvar_e:

  context?

  I just want to avoid placing trades or modify running orders when the market is closed in order not to mess up the log. It is an EA running 24/7

Just thought a little more about it and decided that it will work if I confine myself to do order type commands in the "start" routine. No ticks coming from a closed market

Yes, this is why I was asking " in which context" do you need to know i market is closed.
Bacha Rehman
4465
Bacha Rehman 2013.10.28 20:33  
start routine only runs when mt4 client terminal receive a new tick ... if the market is closed .. then there is no tick .. means start routine will not be called ... means your EA will not place any order .. means relax .. nothing gonna happen :)
To add comments, please log in or register