OrderModify Error#1 Bug or Not?

Back to topics list  | 1 2 To post a new topic, please log in or register
avatar
3849
ubzen 2010.09.06 20:59 #
 

@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 :)

 
avatar
1172
sxTed 2010.09.06 21:36 #
 

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);
}
avatar
7
pije76 2016.03.31 02:38 #
 
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?

Back to topics list   | 1 2  

To add comments, please log in or register