Quote:
|
Originally Posted by blackboxforex
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
|
BlackBox,
To get the integer portion of the value use the function:
PHP Code:
double MathFloor(double x) //for the largest integer
or
PHP Code:
double MathCeil(double x) //for the smallest integer
So, your code should be:
PHP Code:
diff = anch - (MathFloor(anch/incr) * incr);