How to mantaint a single order opened?

 
Hi, may I ask:

It's possible when an EA opens an order, keep JUST that order?

I mean, I want that, whean an EA opens an order, keep that order until S/L or T/P is reached, and just to open positions where there are no orders opened.

Thanks in advance.
 
Try this:

int start()
{
if(OpenOrders()==0){  // will only open new order when there is no existing open order
if(BuySignal==true){
OrderSend(Symbo;(),OP_BUY,.....);
}
if(SellSignal==true){
OrderSend(Symbol(),OP_SELL,.....);
}
}
} // end of int start() {} part of code

// Insert this code after int start()  {} part of code
int OpenOrders() { 
int _total=0; 
for (int i=0; i<OrdersTotal(); i++) { 
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) 
if((OrderSymbol()==Symbol())) 
_total++; 
}  
return(_total); 
} 




 
Thanks.
 
How about something very simple and effective:

int init()
  {
   return(0);
  }
int deinit()
  {
   return(0);
  }
  
int start()
{
  if(OrdersTotal()>0 )
  {
      return(0);
  }

//your code here

return(0);
}