integer portion
blackboxforex:
Hi everyone, codersguru,
Hi everyone, codersguru,
First post here.
I am new to MQL4 but have a few years experience in VB, C# and some C++.
I am trying to do a calculation that operates on the integer portion of a value.
my line of code is :
diff = anch - (int(anch/incr) * incr);
but the compiler is complaining that I have unbalanced parentheses.
Is this the offending part and if so what is the correct way of writing this.
Thanks
BlackBoxBlackBox,
To get the integer portion of the value use the function:
double MathFloor(double x) //for the largest integer[/PHP]
or
double MathCeil(double x) //for the smallest integer
So, your code should be:
[PHP]diff = anch - (MathFloor(anch/incr) * incr);Thanks. And thanks for your quick response.
Hi everyone, codersguru,
First post here.
I am new to MQL4 but have a few years experience in VB, C# and some C++.
I am trying to do a calculation that operates on the integer portion of a value.
my line of code is :
diff = anch - (int(anch/incr) * incr);
but the compiler is complaining that I have unbalanced parentheses.
Is this the offending part and if so what is the correct way of writing this.
Thanks
BlackBox