Trade modification error I can't solve

 

Can anyone please help me solve my EA trade modification error. The EA works fine but the error messages are driving me crazy trying to solve. please see the attached file for the EA

Files:
 
what error ?
 
There is a trade modification error from the trailing stop loss function
 
Adam Woods:
There is a trade modification error from the trailing stop loss function

What is the error and where is it in the code?

 

It is an order modify error from the trailing stop loss

//+------------------------------------------------------------------+
//| Trailing Stop Function  breakout trade                                         |
//+------------------------------------------------------------------+
void RegularTrail()
  {
 
 
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderMagicNumber()==magic)
           
            if(OrderType()==OP_BUY && enableBuyTrail()==true)
            
              {
              
               if(Bid-OrderOpenPrice()>WhenToTrail*pips)
                  if(OrderStopLoss()<Bid-TrailAmount*pips)
                     if(!OrderModify(OrderTicket(),OrderOpenPrice(),Bid-(TrailAmount*pips),OrderTakeProfit(),0,CLR_NONE))
                       {
                        int err=GetLastError();
                        Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err));
                       }//ordermodify
              }//buy order 
         else if(OrderType()==OP_SELL && enableSellTrail()==true)
         
           {
           
            if(OrderOpenPrice()-Ask>WhenToTrail*pips)
               if(OrderStopLoss()>Ask+TrailAmount*pips || OrderStopLoss()==0)
                  if(!OrderModify(OrderTicket(),OrderOpenPrice(),Ask+(TrailAmount*pips),OrderTakeProfit(),0,CLR_NONE))
                    {
                     int err=GetLastError();
                     Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err));
                    }//ordermodiy    
           }//sell order
        }//select an order
      else
        {//in case it fails to select an order.
         int err=GetLastError();
         Print("Encountered an error during order selection in: "+__FUNCTION__+"!"+(string)err+" "+ErrorDescription(err));
        }
     }//for loop
  }

 
Adam Woods:

It is an order modify error from the trailing stop loss


What is the error?????????

 
Adam Woods:

It is an order modify error from the trailing stop loss


first of all you need to check values, your trailing points and broker's stoplevel 

then you need to write down what is error ( in your journal tab )

 
error


Ye sorry this is the journal error

 
  1. Start with identifying which line gives you the message.
    Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err)  ); // 267
    Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err)  ); // 280
    Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err)  ); // 296
    Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err));   // 336
    Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err));   // 346
    Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err));   // 398
    Print("Encountered an error during modification!"+(string)err+" "+ErrorDescription(err));   // 410

  2. Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?

Reason: