Has anyone else experienced some of their MT4 coding stopped working in Strategy Tester

 

Hi Folks,

Some of the functions I have used for years are no longer working in the MT4 platform!  For example, I have used this function for years to delete pending orders, and it has stopped working:

void ClosePendingOrders(int type = 7,  string symbol = "X")

{

    // type = 7 - Close All Pending Orders; else set type to OrderType() to be deleted (2=BL, 3=SL, 4=BS, 5=SS)

    if(symbol == "X") symbol = Symbol();

    for(int a = 0;  a < OrdersTotal();  a++)

    {

        if(OrderSelect(a, SELECT_BY_POS, MODE_TRADES) && OrderSymbol() == symbol && OrderMagicNumber() == MagNum &&

            OrderType() > 1 && (type == 7 || OrderType() == type))

        {

            while(!Testing && IsTradeContextBusy()) Sleep(10);

            bool del = OrderDelete(OrderTicket());

            if(!del) Alert("Trade Delete Error: "+ErrorDescription(GetLastError()));

            else a--;

        }

    }

}


Has anyone else experienced a problem?  It seems to have com about since my MT4 platforms updated to Build 1280 over the weekend!

 
I know that it is not obvious, but topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I will move your topic to the MQL4 and Metatrader 4 section.
 

they get deleted normally 

try this :

void ClosePendings(string symbol)
{
int st=OrdersTotal()-1;
for(int t=st;t>=0;t--)
  {
  bool sel=OrderSelect(t,SELECT_BY_POS,MODE_TRADES);
  if(sel)  
    {
    if(symbol==OrderSymbol()&&OrderType()>=2&&OrderType()<=5)
      {
      bool del=OrderDelete(OrderTicket(),clrBlack);
      continue;
      }
    }
  } 
}