Download MetaTrader 5

Why normalize double on ask/bid if closing?

To add comments, please log in or register
Read the Forum and improve your rating!
Subgenius
582
Subgenius 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:
Simon Gniadkowski
Moderator
18001
Simon Gniadkowski 2013.12.18 11:20  
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
14519
whroeder1 2013.12.18 13:38  
Subgenius: Basically if u use normalize double
Don't
To add comments, please log in or register