Modify Order not working

 
Hi, I have been over this over and over and cannot see what the problem is.  It keeps compiling
//--Adjust stops ----------------------------------------------------------------------//
void AdjustStops()
  {
   
   for(int Orders =OrdersTotal() -1; Orders>=0; Orders--)
     {
     if (!OrderSelect(Orders,SELECT_BY_POS,MODE_TRADES)
        ||(OrderMagicNumber() != MagicNumber)
        ||(OrderType()!= OP_BUY)
        ||(OrderSymbol()==Symbol())                                                        
        ||(!IsThisANewCandle()))
           continue;  
                                                                            
     if(OrderStopLoss() <Low[a])                                                       
        bool res =OrderModify(OrderTicket(),OrderOpenPrice(),Low[a],OrderTakeProfit(),0,clrPink);
     if(!res)
        Print("Error in OrderModify. Error code=",GetLastError()); 
     else 
        Print("Order modified successfullyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); 
     }
  }
and saying res is an undeclared identifier and it is not working even when that is removed. Help.
 
Richard Roberts:
Hi, I have been over this over and over and cannot see what the problem is.  It keeps compiling and saying res is an undeclared identifier and it is not working even when that is removed. Help.
//--Adjust stops ----------------------------------------------------------------------//
void AdjustStops()
  {
   bool res=false;
   for(int Orders =OrdersTotal() -1; Orders>=0; Orders--)
     {
     if (!OrderSelect(Orders,SELECT_BY_POS,MODE_TRADES)
        ||(OrderMagicNumber() != MagicNumber)
        ||(OrderType()!= OP_BUY)
        ||(OrderSymbol()==Symbol())                                                        
        ||(!IsThisANewCandle()))
           continue;  
                                                                            
     if(OrderStopLoss() <Low[a])                                                       
        res =OrderModify(OrderTicket(),OrderOpenPrice(),Low[a],OrderTakeProfit(),0,clrPink);
     if(!res)
        Print("Error in OrderModify. Error code=",GetLastError()); 
     else 
        Print("Order modified successfullyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); 
     }
  }

try this

 
Kenneth Parling:

try this

Thanks, that has fixed it. I can now get an error code. it is '0'. Great.    Can you see what I am missing here with the modify order? i'm stuck

 
Richard Roberts:

Thanks, that has fixed it. I can now get an error code. it is '0'. Great.    Can you see what I am missing here with the modify order? i'm stuck

skip the whole res thing.....

//--Adjust stops ----------------------------------------------------------------------//
void AdjustStops()
 {
   for(int Orders =OrdersTotal() -1; Orders>=0; Orders--)
     {
     if (!OrderSelect(Orders,SELECT_BY_POS,MODE_TRADES)
        ||(OrderMagicNumber() != MagicNumber)
        ||(OrderType()!= OP_BUY)
        ||(OrderSymbol()==Symbol())                                                        
        ||(!IsThisANewCandle()))
           continue;  
                                                                            
     if(OrderStopLoss() <Low[a])                                                       
        if(!OrderModify(OrderTicket(),OrderOpenPrice(),Low[a],OrderTakeProfit(),0,clrPink)){
        Print("Error in OrderModify. Error code=",GetLastError());}
        else{ 
        Print("Order modified successfullyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");} 
     }
  }
 
Kenneth Parling:

skip the whole res thing.....

That worked. Thank you for the help

 
Richard Roberts:

That worked. Thank you for the help

you are welcome ;)

Reason: