OrderModify Error#1 Bug or Not? - page 2

 

@Viffer: I am assuming Point_Info makes that 1 pip. (presumably you would have just used Point if it wasn't). Nope lol. I have the whole list of Market_Info which I give different variable names. Yeah I know in this case it's redundant. In other cases tho like ( int Slippage= MarketInfo(Symbol(),MODE_SPREAD) it shortens the call for whatever the spread is.

 

@WHRoeder: Don't not compare doubles for equality/inequality. Suppose SL=1.2345 and DSS=1.23450000001 They're not equal but you'll get a error 1. Wow - I learn something new everyday. I'm gonna make sure I read that link. I'm also just guessing here but NormalizeDouble (DSS,4) would Not make it equal 1.2345 Either as Kennyhubbard and even myself have tried before. But I'm sure that link would probably tell me why :)

 

There must be a change in value of at least one of the parameters to OrderModify()

//+------------------------------------------------------------------+
//| Function..: OrderModifyPreChecked                                |
//| Purpose...: Check that values to be passed to the OrderModify()  |
//|             function have changed and avoid error 1.             |
//| Parameters: Same as OrderModify()                                |
//| Returns...: bool Success.                                        |
//| Notes.....: The order must have been selected using OrderSelect()|
//| Sample....: if(OrderModifyPreChecked(...)) OrderModify(...);     | 
//+------------------------------------------------------------------+
bool OrderModifyPreChecked(int iTicket, double dPrice, double dSL, double dTP, datetime tExpire, color cColor=CLR_NONE) {
  if(OrderType()<=OP_SELL && ((NormalizeDouble(OrderStopLoss()-dSL,8)!=0) || (NormalizeDouble(OrderTakeProfit()-dTP,8)!=0))) return(true);
  else if(OrderType()>OP_SELL && ((NormalizeDouble(OrderStopLoss()-dSL,8)!=0) || (NormalizeDouble(OrderTakeProfit()-dTP,8)!=0) || (NormalizeDouble(OrderOpenPrice()-dPrice,8)!=0) || (tExpire!=OrderExpiration()))) return(true);
  return(false);
}
 
sxTed:

There must be a change in value of at least one of the parameters to OrderModify()

Great, thanks!

Do you have a sample code to implement this please?

Reason: