close function not working

 

Hmm, is something wrong w/ this close part?

It's not working in my EA ...

        for(ib=0;ib<totalb;ib++)
        { 
        if(OrderSelect(ib,SELECT_BY_POS,MODE_TRADES)) 
        if(OrderType()==OP_SELL) 
        { 
        if (OrderType() == OP_SELL && CloseSell && OrderSymbol()==Symbol()) OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), 1, Red); 
        }
        }

        for(ib=0;ib<totalb;ib++)
        {
        if(OrderSelect(ib,SELECT_BY_POS,MODE_TRADES)) 
        if(OrderType()==OP_BUY) 
        { 
        if (OrderType() == OP_BUY && CloseBuy && OrderSymbol()==Symbol()) OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), 1, Green); 
        }
        }       
 
fulltilt:

Hmm, is something wrong w/ this close part?

It's not working in my EA ...

Yes, there is something wrong: Loops and Closing or Deleting Orders

And, you only need one loop . . .

 

thank You, looks much better ... I will try it ;-)

Regards

Reason: