Searching for a missing order!

 
Could anyone help me here: I have an EA that places trades. I need a loop to go back and find if one of the orders is gone(either closed for a profit or stopped out). The idea is to make sure if my EA places four trades and one is closed, I want that another order to be placed at that price again. Any help would be greatly appreciated! Thank you guys....... Dan
 
You need a proposition, code or whole EA?
 
Roger:
You need a proposition, code or whole EA?

a piece of code.....

 
int numberorders;
...
init(){
...
numberorders=OrderTotal();
....
}
int start(){
...
if(numberorders < OrderTotal())
{
//your code if new order
..
numberorders=OrderTotal();
}
if(numberorders > OrderTotal())
{
OrderSelect(OrdersHistoryTotal()-1, SELECT_BY_POS, MODE_HISTORY) ;
//your code for closed order
numberorders=OrderTotal();
}
...
return(0);
}
 
Roger:
int numberorders;
...
init(){
...
numberorders=OrderTotal();
....
}
int start(){
...
if(numberorders < OrderTotal())
{
//your code if new order
..
numberorders=OrderTotal();
}
if(numberorders > OrderTotal())
{
OrderSelect(OrdersHistoryTotal()-1, SELECT_BY_POS, MODE_HISTORY) ;
//your code for closed order
numberorders=OrderTotal();
}
...
return(0);
}

That's great...not sure it will do what I want. If I place three orders and the first one closes, how can I determine(by price I think is the best way) that order is not there, then replace it? I appreciate your help......... Dan

Reason: