order modify error 1

 

hello, with my trallingstop i get so much order modify error 1 printed that my log file after a long backtest become very big, is it possible to say metatrader dont print that message everytime, because he do it automatic all time when it occur...or must I change the traillingstop code


//----
double bid=NormalizeDouble(MarketInfo(Symbol(),MODE_BID),Digits);
double ask=NormalizeDouble(MarketInfo(Symbol(),MODE_ASK),Digits);
//----
 for(int cnt=0; cnt < OrdersTotal(); cnt++)
 {
 //----
 if(OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES))
  {
   if(OrderType()<=OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber()==Magicnumber)
    {
     if(OrderType()==OP_BUY)
      {
       if(bid-OrderOpenPrice()>=TrailingStop)
        {
         if((OrderStopLoss()<bid-(TrailingStop)&&OrderTakeProfit()!=(bid-(TrailingStop))) || (OrderStopLoss()==0))
          {
           OrderModify(OrderTicket(),OrderOpenPrice(),bid-TrailingStop,OrderTakeProfit(),0,Green);
           int err = GetLastError();
           if(err != 0)Print("Trailingstop Error modiy Buyorder error #",err);
           return(0);
          }
         }
        }
        else if(TrailingStop>0)
         {
          if(((OrderOpenPrice()-ask)>(TrailingStop)&&OrderTakeProfit()!=(ask+TrailingStop)))
           {
            if(OrderStopLoss()>(ask+TrailingStop) || (OrderStopLoss()==0))
            {
             OrderModify(OrderTicket(),OrderOpenPrice(),ask+TrailingStop,OrderTakeProfit(),0,Red);
             err = GetLastError();
             if(err != 0)Print("Trailingstop Error modiy Sellorder error #",err);
             return(0);
            }
           }
          }
         }
        }
     //----
    }
 

https://www.mql5.com/en/forum/124153, "Error 1 and I don't know why"

 
SwingTradeing:

hello, with my trallingstop i get so much order modify error 1 printed that my log file after a long backtest become very big, is it possible to say metatrader dont print that message everytime, because he do it automatic all time when it occur...or must I change the traillingstop code


TrailingStop*Point
Reason: