I think I am overlooking something patently obvious here
The results of the print out statement (logInfo) return 130 for myVal, 288 for totalR, and ZERO for ratio
Why???? ratio is declared as a double
EDIT:
So it looks like MQ4 assumes you are doing integer arithmetic if all the values in an expression are integers, even if the variable the result is being stored in is a double. DUH. Better times 1.0 then (myVal * 1.0 / totalR).
What you are overlooking something patently obvious was that you didn't tell us what type myVal, and totalIR and the values assigned to them.
It's type casting https://docs.mql4.com/basis/types/casting , been asked too many times in forum https://www.mql4.com/search#!keyword=typecasting&module=mql4_module_forum&page=1
The results of the print out statement (logInfo) return 130 for myVal, 288 for totalR, and ZERO for ratio
Why???? ratio is declared as a double
130/288 = zero. Thus ratio = Double(0) = 0.0
On MT4 v434, division quotient don't give floating point values(Bug??) - MQL4 forum
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I think I am overlooking something patently obvious here
The results of the print out statement (logInfo) return 130 for myVal, 288 for totalR, and ZERO for ratio
Why???? ratio is declared as a double
EDIT:
So it looks like MQ4 assumes you are doing integer arithmetic if all the values in an expression are integers, even if the variable the result is being stored in is a double. DUH. Better times 1.0 then (myVal * 1.0 / totalR).