Deleting pending order on ecn account

Thiamiin
9
good day guys 

i have a question about deleting pending order on ecn account ,
the orders type are sell stop and buys top 

i use a simple function to delete orders , as below 

   void ClosePendingOrder()                                                 
   {
      for(int i=OrdersTotal()-1;i>=0;i--)                                     
      {
         if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         {
            if(OrderMagicNumber()==magic_number)
            {
               if(OrderType()==OP_BUYSTOP || OrderType()==OP_SELLSTOP)
               {
                  bool delorder = OrderDelete(OrderTicket(),clrBlack);
               }
            }
         }
      }
   }
   

i have check it on demo account , and it work 
but i couldn't figure out why this isn't working on ecn account 

i have check marketinfo for stop_level , and it return 0 ,

i appreciated if you guys help me , thank you 
William Roeder
25824
William Roeder  
  1.  bool delorder = OrderDelete(OrderTicket(),clrBlack);
    Don't just silence the compiler.

    Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (MT5/MT4+strict), it is trying to help you.
              What are Function return values ? How do I use them ? - MQL4 programming forum (2012)
              Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles (2014)

  2. On ECN zero means the broker doesn't know. Use a minimum of 2 PIPs.
  3. I have seen occasionally an open order still shown as pending; restart the terminal.
Thiamiin
9
Thiamiin  
William Roeder #:
  1. Don't just silence the compiler.

    Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (MT5/MT4+strict), it is trying to help you.
              What are Function return values ? How do I use them ? - MQL4 programming forum (2012)
              Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles (2014)

  2. On ECN zero means the broker doesn't know. Use a minimum of 2 PIPs.
  3. I have seen occasionally an open order still shown as pending; restart the terminal.

thank you William , 
im going to read the pages you provided their link , and try to correct my code and find my problem 

again thank you 
appreciated your help