MapBuffer[i]=1.0/5.0;
5.0/2.0
Flirrrt :
I've encountered a very strange problem, which I have absolutely no idea of how to solve. two integer values won't be divided!
I've set up a custom indicator, and the buffer plots on the chart. What I want to do is to get a smoothing value, and assign this to a variable (1/length).
BUT, when I try to plot this it only gives me zeros... the variables are declared correctly (doubles), and I've tried to do the calcuation directly int the buffer.
MapBuffer[i]=1/5; // Should give 0.2 but is 0.0000...
I tried multiply, add and subtract, and everything works fine.. exept when the result of the divide is below is not equal to an integer (but the Buffer is declared as a double).
Not even 5/2 gives the correct value (2.5), instead shows 2. I must do something fundamentally wrong.. but what?
Appreciate every answer!
Best Regards,
Johan
I've encountered a very strange problem, which I have absolutely no idea of how to solve. two integer values won't be divided!
I've set up a custom indicator, and the buffer plots on the chart. What I want to do is to get a smoothing value, and assign this to a variable (1/length).
BUT, when I try to plot this it only gives me zeros... the variables are declared correctly (doubles), and I've tried to do the calcuation directly int the buffer.
MapBuffer[i]=1/5; // Should give 0.2 but is 0.0000...
I tried multiply, add and subtract, and everything works fine.. exept when the result of the divide is below is not equal to an integer (but the Buffer is declared as a double).
Not even 5/2 gives the correct value (2.5), instead shows 2. I must do something fundamentally wrong.. but what?
Appreciate every answer!
Best Regards,
Johan
Hi,
I have the same problem, did you find any solution ?
It must be a way to divide two integers and have the result as a double !
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
I've set up a custom indicator, and the buffer plots on the chart. What I want to do is to get a smoothing value, and assign this to a variable (1/length).
BUT, when I try to plot this it only gives me zeros... the variables are declared correctly (doubles), and I've tried to do the calcuation directly int the buffer.
MapBuffer[i]=1/5; // Should give 0.2 but is 0.0000...
I tried multiply, add and subtract, and everything works fine.. exept when the result of the divide is below is not equal to an integer (but the Buffer is declared as a double).
Not even 5/2 gives the correct value (2.5), instead shows 2. I must do something fundamentally wrong.. but what?
Appreciate every answer!
Best Regards,
Johan