I think it is because you are using integers to do a calculation that would create a double
try it like this
double Cur_EffSum, Cur_StratEff; double Cur_BKPercent; Cur_StratEff = 75; Cur_EffSum = 190; Cur_BKPercent = Cur_StratEff / Cur_EffSum * 100; Print("Cur_BKPercent: ", DoubleToStr(Cur_BKPercent,8));
another trick, when wanting to use integers ('cos they display real nice!) is
double myVal = (1.0 * int1) / int 2; //convert to double before doing integer division
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
A strange behaviour :
output :
Cur_BKPercent: 0
But this :
output :
Cur_BKPercent: 39.47368421
I guess it's because it's first divided and then it's too small, so reduced to 0, before it's multiplied by 100. But if it's first multiplied by 100 then it's big enough. Maybe it's because the first 2 variables are integers, so it rounded it to an integer.
Strange though :)