How to avoid opening of new order - page 2

 
sachin7:

Hello Ahmet,

orderstotal will return all pending and open order and orderselect will help me to filter out pending or open order. Issue is how do I check order open in current London session? Orderselect selects the open order which is open yesterday or before... I just want to check if EA opens order in current London session then EA should not open any new order in current London session, also EA should not impact order open before current London session i.e. Yesterday or before London session. EA should allow opening on new order in next London session

Returns open time of the currently selected order.

https://docs.mql4.com/trading/orderopentime

you can use OrderCloseTime() depending on your strategy

OrderOpenTime - Trade Functions - MQL4 Reference
OrderOpenTime - Trade Functions - MQL4 Reference
  • docs.mql4.com
OrderOpenTime - Trade Functions - MQL4 Reference
 
Ahmet Metin Yilmaz:

Returns open time of the currently selected order.

https://docs.mql4.com/trading/orderopentime

you can use OrderCloseTime() depending on your strategy

Hello Ahmet,


I have checked orderopentime as well, it returns the date and time of order open, I really dont know hpw to compare this string which contains order date & time. Below is the example, highlighted in bold ...

2018.11.13 17:18:29.773 2018.06.08 19:00:00  OpenOrder EURJPY,H1: Order Open Time2018.06.08 18:37:09

 
sachin7:

Hello Ahmet,


I have checked orderopentime as well, it returns the date and time of order open, I really dont know hpw to compare this string which contains order date & time. Below is the example, highlighted in bold ...

2018.11.13 17:18:29.773 2018.06.08 19:00:00  OpenOrder EURJPY,H1: Order Open Time2018.06.08 18:37:09

find which day order open time in the year with

orderopenday=TimeDayOfYear(OrderOpenTime())

and go to order open logic add this

TimeDayOfYear(TimeCurrent())>orderopenday

this is the easy way to make it. There are lots of way too

 

Forum on trading, automated trading systems and testing trading strategies


Alain Verleyen, 2018.11.12 16:35

mql4 topic in mql4 section of the forum please.

 
Ahmet Metin Yilmaz:

find which day order open time in the year with

orderopenday=TimeDayOfYear(OrderOpenTime())

and go to order open logic add this

TimeDayOfYear(TimeCurrent())>orderopenday

this is the easy way to make it. There are lots of way too

Hello Ahmet,


Hope you are well...

is similar function available for weekly period? What I mean, if an order is open for a given week then no new order should be open as long as order survives the existing week. Then new week new order can be open irrespective whether previous week order survives or not...  

 
sachin7:

Hello Ahmet,


Hope you are well...

is similar function available for weekly period? What I mean, if an order is open for a given week then no new order should be open as long as order survives the existing week. Then new week new order can be open irrespective whether previous week order survives or not...  

TimeSeconds (), TimeMinute(), TimeHour(), TimeDay(), TimeMonth(), TimeYear(), TimeDayOfWeek () and TimeDayOfYear() 

all time functions above 


Reason: