Modify Order not working

To add comments, please log in or register
Richard Roberts
209
Richard Roberts  
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.
Kenneth Parling
8657
Kenneth Parling  
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

Richard Roberts
209
Richard Roberts  
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

Kenneth Parling
8657
Kenneth Parling  
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");} 
     }
  }
Richard Roberts
209
Richard Roberts  
Kenneth Parling:

skip the whole res thing.....

That worked. Thank you for the help

Kenneth Parling
8657
Kenneth Parling  
Richard Roberts:

That worked. Thank you for the help

you are welcome ;)

To add comments, please log in or register