iMACD = zero divide

 

I've been writing a Program that includes the iMACD -function, but whenever I tried to get a Signal of the MACD, I got the message: zero divide.

By finding the Problem I printed: iMACD(NULL,0,10,20,7,PRICE_MEDIAN,MODE_MAIN,1) only, and realized that whenever the MACD value get smaller, It will give me the message: zero divide.

So far I could find this Problem in calcuations only.

How can I solve this Problem and get a proper value of iMACD?

 
tak88js:

I've been writing a Program that includes the iMACD -function, but whenever I tried to get a Signal of the MACD, I got the message: zero divide.

By finding the Problem I printed: iMACD(NULL,0,10,20,7,PRICE_MEDIAN,MODE_MAIN,1) only, and realized that whenever the MACD value get smaller, It will give me the message: zero divide.

It seems improbable that the built-in function, used by thousands of people has, itself, a built-in divide by zero error. I would therefore suggest that your code surrounding the function call has an error. Post enough of the surrounding code and somebody may spot it for you.
 
dabbler:
It seems improbable that the built-in function, used by thousands of people has, itself, a built-in divide by zero error. I would therefore suggest that your code surrounding the function call has an error. Post enough of the surrounding code and somebody may spot it for you.


Right!

The following line was at the end of my EA:

Print(iMACD(NULL,5,10,20,7,PRICE_CLOSE,MODE_MAIN,1));


Without the rest of the code there is no mistake.

So the Error is caused by another Function in the EA!? Because then I don't understand the relation of the Error to the Print-function.

 
Check out this Link. And here's another Link. And here's another Link.