
3206 


I'm not exactly sure what you question is but that's not gonna stop me from taking a stab at it.... when you declare your OrdersToPlace variable as an integer that means it is a whole number with no decimal point... when you do all that math on it that includes 100.2 and use MarketInfo which is a double not an integer .. your answer will be a double... i.e. have a decimal point in it..... so if it comes up with 3.56 and you are trying to save it as and integer... it's going to return the integer value closest to 3.56... i.e. 4..... What it amounts to is that you are losing precision.. 

nondisclosure:
Any ideas on any of these? Thanks in advance!
double MathFloor( double val // number ); // Return Value A numeric value representing the largest integer that is less than or equal to val. is just that, a double function returns a double numeric value equal to the largest integer. If your calculations include doubles, even if the result is a whole number, it will be a double type that has a numeric value of an integer type. Does it make any sense ? Example : int x =1; double z = 1.0; Both have a numeric value of 1. So they're equal but not quite. One is of integer type, the other one is a double. Possible loss of data due to conversion happens when you try things like int y=x+z; The result is 2, it looks like an int type but it's the sum of a double and an integer. Some use that to get the int numeric value of a double like this : double x = 3.5 ; int z = 2; int y = xz ; you get y = 1 and a " possible loss of data due to conversion" warning that you will ignore if you did that on purpose. The rest int vdigits = MarketInfo("EURUSD",MODE_DIGITS); int vspread = MarketInfo("EURUSD",MODE_SPREAD); For the above 2 lines, as long as MarketInfo remains a double type function, the error is in the documentation and you deserve 100 credit points for pointing that out Here, if this is your code (else if it's from documentation, they made another mistake ) int OrdersToPlace = MathFloor( 100.2 / MarketInfo(FinalSymbol, MODE_MAXLOT ) )+1; you try to assign to an integer type the numeric value equal to an integer but the format of a double type variable. Sort of : int type = double type(double/double)+1; Mix and match. You don't know how hard it is to try and explain these things ! Does it make any sense ? It's like a particular case of a double type when the numeric value is equal to an integer, but that doesn't make it less of a double. A double remains a double type even when the value hold by it is equal to the value of an integer. OrdersTo Place is of int type. 100.2 is a double. MathFloor is adouble hence it's return has to be a double type. Then you say an int type = double type ! And that's how you get the possible loss of....... warning. The program doesn't know if you did that on purpose or it's just a mistake so it will warn you but will compile and run it. If in fact that is your intention, to get the integer numeric value and store it into an int type variable, you tell the program to shut up like this : int OrdersToPlace =(int) MathFloor( 100.2 / MarketInfo(FinalSymbol, MODE_MAXLOT ) )+1; Now it knows you did it on purpose and you won't get the warning. That's about it. Did it help at all ? Cheers 



WHRoeder:
double vbid = MarketInfo("EURUSD",MODE_BID); double vask = MarketInfo("EURUSD",MODE_ASK); double vpoint = MarketInfo("EURUSD",MODE_POINT); int vdigits = MarketInfo("EURUSD",MODE_DIGITS);// This looks wrong to me int vspread = MarketInfo("EURUSD",MODE_SPREAD);// This looks wrong as well isn't his code, he was pointing to an error in the documentation. vdigits is of integer type and MarketInfo is a double type function. Digits is of int type, MarketInfo("EURUSD",MODE_DIGITS) isn't. He says he was puzzled when his code int myDigits = MarketInfo( Symbol(), MODE_DIGITS ); done as per documentation example int vdigits = MarketInfo("EURUSD",MODE_DIGITS); returned a possible loss of data due to conversion error. And he is right, the documentation example is wrong. 

Still not fixed. And SymbolInfoInteger isn't any help either. :(


Well, for now, I'm going to have to do this (pass symbol to it): int GetDigit(string Sym) { int ReturnValue=5; string back=StringSubstr(Sym,3,3); if(back=="JPY") { ReturnValue=3; } return(ReturnValue); } 
3206 
nondisclosure: Still not fixed. And SymbolInfoInteger isn't any help either. :( What should fixed ? I can't see any error either in mql4 or in the documentation. MarketInfo() is a function returning a double type. If used with MODE_DIGITS or MODE_SPREAD, the value returned will an integer. A double type variable can contain an integer value. Maybe I missed your point ? 

thrdel: returned a possible loss of data due to conversion error. And he is right, the documentation example is wrong.
Exactly. MarketInfo(DIGITS) and SPREAD returns an int value as a double. Just suppress the warning when converting the double to int.angevoyageur: A double type variable can contain an integer value. Maybe I missed your point ? int myDigits = (int) MarketInfo( Symbol(), MODE_DIGITS ); 

Typecasting. Grrrrr. Now I just wish they'd update the help documentation. 
I've got a couple of them where I'm getting this and I'm lost.
1st up:
Now, help text has some sample code that leaves me to believe either I'm not reading it right or I'm loosing my mind:
2nd up:
Help text, again not all that helpful:
The text says: "The function returns integer numeric value closest from below."
The sample shows:
Any ideas on any of these?
Thanks in advance!