min e max price within a group of pending order

 

hi everybody, 

i have  "n" pending orders, i need to extract the lower and the higher price which they are set to start.

ie:

buystop  price open: 0,98251, 0,98351,0,98451, 0,98551 etc... i need to extract 0,98251 as lower and 0,98551 as higher.

I m using this code, but does'n extract the lower price. I was trying to user DBL_MIN and DBL_MAX, but I'm stuck and not able to finalize, could you tip please?

double lower_price = 9999999;
   
for(int i=0; i<=OrdersTotal(); i++)
 {
      OrderSelect(OrderGetTicket(i));
      string OrderSymbol = OrderGetString(ORDER_SYMBOL);
      if(OrderSymbol == Symbol())
  {
        ENUM_ORDER_TYPE typeB=(ENUM_ORDER_TYPE)OrderGetInteger(ORDER_TYPE);
        if(typeB==ORDER_TYPE_BUY_STOP )
   {
        number_of_buy_stop_order ++;

        open_price =  NormalizeDouble((OrderGetDouble(ORDER_PRICE_OPEN)),_Digits);
        if (open_price < lower_price)
          lower_price = open_price;
            
    {
}
}
}
}