Download MetaTrader 5

Simple test to determine if market is closed?

To add comments, please log in or register
Ingvar Engelbrecht
4506
Ingvar Engelbrecht  
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
96755
Sergey Golubev  
You can not open the trade because market is close
Alain Verleyen
Moderator
32377
Alain Verleyen  
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
4506
Ingvar Engelbrecht  
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
32377
Alain Verleyen  
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
4569
Bacha Rehman  
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