Download MetaTrader 5

Why normalize double on ask/bid if closing?

To add comments, please log in or register
Brian Lillard
597
Brian Lillard  

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:
Simon Gniadkowski
Moderator
18023
Simon Gniadkowski  
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 ! !
whroeder1
15303
whroeder1  
Subgenius: Basically if u use normalize double
Don't
To add comments, please log in or register