ExtMBuffer is not the same as ExtCCIBuffer.
Obviously not, but that shouldn't affect in the error since it's the dividend
The indicator code is based on this one, with very slight modifications: https://www.mql5.com/en/code/18

- www.mql5.com
if (zeroSupposedly == 0.0 || ExtMBuffer == 0)
Im sorry i made a mistake.
if (zeroSupposedly == 0.0 || ExtMBuffer[i] == 0)This will only be truth when both values != differ 0
Im sorry i made a mistake.
This will only be truth when both values != differ 0Im sorry i meant to say false not true.
If you need true then it would be like this:
if (zeroSupposedly != 0.0 && ExtMBuffer[i] != 0)
Don't use "==" or "!=" on doubles. Its untrustworthy. Try this (untested) and see what you get ...
double zeroSupposedly = ExtDBuffer[i]; ExtCCIBuffer[i] = ( zeroSupposedly < 0 ) || ( zeroSupposedly > 0 ) ? ExtMBuffer[i] / zeroSupposedly : 0;
By the way, the value of ExtMBuffer[i] has noting to do with zero-divide error, be it a 0 or not. Only zeroSupposedly can cause that.
Don't use "==" or "!=" on doubles. Its untrustworthy. Try this (untested) and see what you get ...
By the way, the value of ExtMBuffer[i] has noting to do with zero-divide error, be it a 0 or not. Only zeroSupposedly can cause that.
Thank you very much, this seems to work fine

- 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'm getting some zero-division errors in my code and I don't even know why, or how. I have tried checking the values in every possible way:
How could that even be possible? My program is a bit heavy (and probably that is where the cause is), but even then, what could make the value pass the first condition and give error?