Ok, now, letīsee the a couple of things.
One big difference in the code of iMACD (Iīm trying to contact them) is the way to calculate the signal line.
First, he add two vars
PHP Code:
alpha = 2.0 / (SignalMAPeriod + 1.0);
alpha_1 = 1.0 - alpha;
and then he use this values to multiply the signal line.
Why? hereīs the answer
PHP Code:
SignalLineBuffer[i] = alpha*MACDLineBuffer[i] + alpha_1*SignalLineBuffer[i+1];
The technical explanation is: because
Mmm, wait a minute. Appel and all explanations says EMA, but I saw an SMA somewhere.
Where? In the original Metaquotes MACD, check by yourself.
Quote:
|
ind_buffer2[i]=iMAOnArray(ind_buffer1,Bars,SignalSMA,0,MODE_SMA, i);
|
Again the same question, who is right? who is wrong?
So, if we change just one letter we can obtain a line like this
Quote:
|
ind_buffer2[i]=iMAOnArray(ind_buffer1,Bars,SignalSMA,0,MODE_EMA, i);
|
And the slope of the signal line start to be close with the aforementioned software.
Take a look at the next picture
Programmers, what you think?
Who is right? Who is wrong? Iīm right? Iīm wrong?
Itīs bug in the Metaquotes MACD code?
macdg.gif