Why normalize double on ask/bid if closing? New comment Brian Lillard 2013.12.18 00:54 Basically if u use normalize double it rounds the decimal to digits, and it seems like this would not be acceptable to the broker. slippage is already a factor if the prices change.. I was looking at an include from IBFX that you can see here, that rounds the ask and bid to close the order void CloseAll( string Sym, int MagicNumber, int Type, int MaxTry, int Slippage, string Commentary ) if( SymPoints == 0.001 ) { SymPoints = 0.01; SymDigits = 3; } else if( SymPoints == 0.00001 ) { SymPoints = 0.0001; SymDigits = 5; } double SymAsk = NormalizeDouble( MarketInfo( Sym, MODE_ASK ), SymDigits ); double SymBid = NormalizeDouble( MarketInfo( Sym, MODE_BID ), SymDigits ); if( OrdType == OP_BUY ) { OrderClose( OrderTicket(), OrderLots(), SymBid, Slippage*SymPoints, CLR_NONE ); } else if( OrdType == OP_SELL ) { OrderClose( OrderTicket(), OrderLots(), SymAsk, Slippage*SymPoints, CLR_NONE ); } I wonder if anyone can elaborate.. Files: ibfxo-hquicklscripts.mqh 16 kb CCI Crossover Strategy (Developing) How to code? how modify this EA work in different broker Simon Gniadkowski 2013.12.18 11:20 #1 Subgenius: Basically if u use normalize double it rounds the decimal to digits, and it seems like this would not be acceptable to the broker. I wonder if anyone can elaborate.. The author of the code is an idiot ! ! William Roeder 2013.12.18 13:38 #2 Subgenius: Basically if u use normalize doubleDon't New comment
Basically if u use normalize double it rounds the decimal to digits, and it seems like this would not be acceptable to the broker.
slippage is already a factor if the prices change..
I was looking at an include from IBFX that you can see here, that rounds the ask and bid to close the order
void CloseAll( string Sym, int MagicNumber, int Type, int MaxTry, int Slippage, string Commentary )
if( SymPoints == 0.001 ) { SymPoints = 0.01; SymDigits = 3; }
else if( SymPoints == 0.00001 ) { SymPoints = 0.0001; SymDigits = 5; }
double SymAsk = NormalizeDouble( MarketInfo( Sym, MODE_ASK ), SymDigits );
double SymBid = NormalizeDouble( MarketInfo( Sym, MODE_BID ), SymDigits );
if( OrdType == OP_BUY ) { OrderClose( OrderTicket(), OrderLots(), SymBid, Slippage*SymPoints, CLR_NONE ); }
else if( OrdType == OP_SELL ) { OrderClose( OrderTicket(), OrderLots(), SymAsk, Slippage*SymPoints, CLR_NONE ); }
I wonder if anyone can elaborate..