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.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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