Does anyone know how to code pending orders?

 

Hi everyone

My problem is to close a pending order according to another opened order. For example, it is an opened order on GBPUSD and its own SL & TP, beside that there is a pending order wait to be executed by reaching to SL point of opened order. But I want the pending order to be deleted when the opened order reaches to its TP.

Does anyone know how to code to delete pending orders with this circumstance in MT4?


 
farrokhfa:

Hi everyone

My problem is to close a pending order according to another opened order. For example, it is an opened order on GBPUSD and its own SL & TP, beside that there is a pending order wait to be executed by reaching to SL point of opened order. But I want the pending order to be deleted when the opened order reaches to its TP.

Does anyone know how to code to delete pending orders with this circumstance in MT4?



https://www.mql4.com/search#!keyword=oco%20order
 

Is the first order opened by EA?

 
patrick007:

Is the first order opened by EA?


No, it is opened by Market Execution method.

 
farrokhfa:

No, it is opened by Market Execution method.

When OrdersTotal() is changing to lower size you can check

the moment the market is closed by takeprofit you can't find the open markettrade of your EA in OrdersTotal()

but there is still pendingtrade open you can after you checked all the trades delete your pending trade

 
deVries:

When OrdersTotal() is changing to lower size you can check

the moment the market is closed by takeprofit you can't find the open markettrade of your EA in OrdersTotal()

but there is still pendingtrade open you can after you checked all the trades delete your pending trade

Do u know how to code? I'm new...
 
farrokhfa:
Do u know how to code? I'm new...


Yes,I can code for you at Jobs or you

learn to code yourself and come here when you struggle with the code you made so far

So Search for it, learn to code it, or pay someone.

and remember here we are willing to HELP you for free when you post your attempt (using SRC) and the nature of your problem,


Reason: