How to avoid opening of new order

 

Hello,


I have EA which opens order during London session (I am working on 1Hr time frame). If order is open then EA should not open new order in same session if already open order survives the London session. Issue with EA is it keeps on opening new order even open order exist. Can someone help me to fix this issue?


Thanks

 
sachin7:

Hello,


I have EA which opens order during London session (I am working on 1Hr time frame). If order is open then EA should not open new order in same session if already open order survives the London session. Issue with EA is it keeps on opening new order even open order exist. Can someone help me to fix this issue?


Thanks

Check if there is an open order and then make the opening only when no open order exist

 
amando:

Check if there is an open order and then make the opening only when no open order exist

Hello Amando,

Thanks for response... I did it and it stops opening all further orders. As per my strategy if order is open then EA should not open new order in same London session however, EA should open new (subject to signal candle) order on next London session.

 
sachin7:

Hello Amando,

Thanks for response... I did it and it stops opening all further orders. As per my strategy if order is open then EA should not open new order in same London session however, EA should open new (subject to signal candle) order on next London session.

you should check both in the history and open orders if has or had opened orders in todays london time .

if you think you did, check your checking criteria. It must be something wrong in it.

 
Ahmet Metin Yilmaz:

you should check both in the history and open orders if has or had opened orders in todays london time .

if you think you did, check your checking criteria. It must be something wrong in it.

Hello Ahmet,


How can I check order opens in current London session and should ignore the order open before (i.e. past London session)

 

you said 'I did check...' before in your post?


MT4 or MT5

 
Ahmet Metin Yilmaz:

you said 'I did check...' before in your post?


MT4 or MT5

as I mentioned i checked the open order and deny further opening of orders and then on wards EA stop opening orders in subsequent London session...I just want my EA to avoid opening order in current London session if an order is open in current london session but EA should open order in next London session (subject to signal)... 

hope it clarifies...

 
sachin7:

as I mentioned i checked the open order and deny further opening of orders and then on wards EA stop opening orders in subsequent London session...I just want my EA to avoid opening order in current London session if an order is open in current london session but EA should open order in next London session (subject to signal)... 

hope it clarifies...

MT4 or MT5?

which one you are using

 
Ahmet Metin Yilmaz:

MT4 or MT5?

which one you are using

MT4
 
sachin7:
MT4

The function selects an order for further processing.

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

Returns the number of closed orders in the account history loaded into the terminal.

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

Returns the number of market and pending orders.

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

OrderSelect - Trade Functions - MQL4 Reference
OrderSelect - Trade Functions - MQL4 Reference
  • docs.mql4.com
To find out from what list the order has been selected, its close time must be analyzed. If the order close time equals to 0, the order is open or pending and taken from the terminal open orders list. One can distinguish an opened order from a pending order by the order type. If the order close time does not equal to 0, the order is a closed...
 
Ahmet Metin Yilmaz:

The function selects an order for further processing.

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

Returns the number of closed orders in the account history loaded into the terminal.

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

Returns the number of market and pending orders.

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

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

Reason: