Invalid price for OrderClose function - page 2

 
  1. You don't close Buy limits or buy stops, you delete them. Once they trigger they become OP_BUY
  2. Some FIFO brokers like IBFX implement the FIFO at their end, so mt4/EA doesn't need to change (just count down)
  3. Either use a backend broker, or choose a non-us broker (fxcm.uk, alpari.uk, ibfx.au, etc.)
 

what does this mean.

Does my function (with counting backwards) work with every broker, or do I have to change it (first write the ordernumbers in an array,...)?

Is my function "secure" how I wrote it?

Thank you!

 
int CloseAll()
   {
      int check = 1;
      int err;
      bool rueck; 

      int   i , N ; N  = OrdersTotal  () - 1 ;
      for ( i = N ; i >= 0 ; i --      )
      {
       OrderSelect    ( i , SELECT_BY_POS , MODE_TRADES );
      
       if((OrderType()==OP_BUY) || (OrderType()==OP_SELL))      
         {
           rueck = OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),0,White);
            if(rueck == false)
               check = -1;
         } // if 

       if((OrderType()==OP_SELLLIMIT) || (OrderType()==OP_SELLSTOP) || (OrderType()==OP_BUYLIMIT) || (OrderType()==OP_BUYSTOP))      
         {
           rueck = OrderDelete(OrderTicket());
            if(rueck == false)
               check = -1;
         } // if

      } // for

      return (check);
   } //