ordermodify error 1 even though there's break operator

 

Hi I've met ordermodify error 1. I know the reason why it returns error 1. The problem lies in changing the open price value with the same value. I tried to break the loop but it still return the same error. Anyone can help me why break statement isn't working here?

void UpdateOpenPrice()
  {
   for(int i = OrdersTotal() - 1; i >= 0; i--)
     {
      if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) &&
         OrderSymbol() == Symbol() &&
         OrderMagicNumber() == MagicNumber)
        {
         double OpenPrice = 0;
         if(OrderType()!=OP_BUYSTOP && OrderType()!=OP_SELLSTOP) //if it's not stop order then break
            break;
         if(OrderType() == OP_BUYSTOP)
           {
            OpenPrice     = IndiDown()+25*Point();
           }
         if(OrderType() == OP_SELLSTOP)
           {
            OpenPrice     = IndiUp()-25*Point();
           }
         //Print("order open: ",OrderOpenPrice());
         //Print("open price: ",OpenPrice);
         if(OrderOpenPrice() == OpenPrice) //if the stoploss order and OpenPrice var has same value, breaks
           {
            break;
           }
         if(OrderModify(OrderTicket(), OpenPrice, OrderStopLoss(), OrderTakeProfit(), OrderExpiration()))
           {
           }
         else
           {
            Print("Order failed to update with error: ", GetLastError());
           }
        }
      else
        {
         Print("Failed to select the order: ", GetLastError());
        }
     }
  }
 

Doubles are rarely equal. Understand the links in:
          The == operand. - MQL4 programming forum #2 (2013)

Make sure you are moving it at least a tick size.

Open price for pending orders need to be normalized to tick size (not Point).
          On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 programming forum (2011)

And abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 programming forum (2012)