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

To add comments, please log in or register
ovatsug
58
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()

rrocchi
163
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? 

ovatsug
58
ovatsug  
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.

To add comments, please log in or register