Select all open order with stop above entry price (breakeven)

rrocchi  
ovatsug:

Hello I'd like to know how to implement in my EA a code that selects all Open Orders that have moved the stop level above the entry price. 

I'm thinking in something like this: 

Buy Order: OrderStopLoss() > OpenOrderPrice()

Sell Order: OrderStopLoss() < OpenOrderPrice()


What have you tried to code? What are the errors being returned? 

Gustavo Gregolin Carneiro  
rrocchi:


What have you tried to code? What are the errors being returned? 

I'm trying something like this: 

if (OrderSelect(i,SELECT_BY_POS)) 



if (OrderSymbol() == Symbol()){

return;}




  int type   = OrderType();


  bool result = false;

 

  if (OrderSymbol () != Symbol()){

  if (OrderType () == OP_BUY){

  if (OrderStopLoss() > OrderOpenPrice()) {

  gobuy();



But apparently it only check order number one in the pool.