I solved it!!
For some mysterious reason, you can´t divide two ints and get a double.. Hmm, I don´t see the logic in that.
Search words:
Problems with division
Division results in round numbers
Divide int
Try reading this article on typecasting.
The relevant bits are these examples:
Examples:
int i=1/2; // no types casting, the result is 0 |

- docs.mql4.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hallo forum!: First post
Until now I ´ve solved all problems on my own, by googeling. But this as puzzled me for months.
I´ve either figuerd ways around it or ignored it. It´s only in some functions it shows up...
if(AboveCounter>BelowCounter&&AboveCounter>0&& BelowCounter>0) xBias=NormalizeDouble(AboveCounter/BelowCounter,2);
if(BelowCounter>AboveCounter&&AboveCounter>0&& BelowCounter>0) xBias=NormalizeDouble(BelowCounter/AboveCounter,2);
Alert("Depth ",xRangeDepth," ",AboveCounter," ",BelowCounter," ",xBias);
Why is xBias only getting round numbers, like 1.0, 2.0, 3.0 when the variables AboveCounter and Belowcounters can be 18/32, 45/19, 15/27 etc..
If anyone could help me I would be very thankfull!