cant close my positions

 

Hi guys

i write a function that check if in timefram 5m the last candle is ascending then close sell position an if last candle is descending close buy position

but it cant close positions

when i try to comment returning OrderClose on chart it only comment false

please help me that where is my mistake

thanks.

void close_pos()
  {
   bool ordrcls;
   for(int i=OrdersTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(iClose(Symbol(),PERIOD_M5,0)>iOpen(Symbol(),PERIOD_M5,0) && (OrderMagicNumber()==SellMagic))
           {
            ordrcls = OrderClose(i,OrderLots(),OrderClosePrice(),5,clrRed);
            if(ordrcls== true)
               Comment("TRUE");
            else
               Comment("FALSE");
           }
         if(iClose(Symbol(),PERIOD_M5,0)<iOpen(Symbol(),PERIOD_M5,0) && OrderMagicNumber()==BuyMagic)
           {
            ordrcls = OrderClose(i,OrderLots(),OrderClosePrice(),5,clrRed);
            if(ordrcls== true)
               Comment("TRUE");
            else
               Comment("FALSE");
           }
        }
     }
  }
 
//ordrcls = OrderClose(i,OrderLots(),OrderClosePrice(),5,clrRed);
//Try
  ordrcls = OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),5,clrRed);
 
thanks a lot Keith