MQL4 - automated forex trading   /  

Forum

Login | Register | Language: ru cn en
Have Something to Say to Traders? Welcome to Blogs!

iMACD() variation from MACD construction

Back to topics list To post a new topic, please log in or register
avatar
92
ququr 2006.04.26 00:38
 
Has anyone already brought up that iMACD is different from a constructed MACD? Not just how it's displayed, but the values are wrong. There are some other constructions out there (MACD_c2 is one, but it has an SMA instead of EMA for the signal line which needed to be corrected) for bar-to-bar comparison. the difference is subtle, but it's different. What does he guts of the iMACD() look like?
I built a MACD function in an EA using iMA() and iMAonArray() to get the correct functionality, and I'm happy with that, but I wondered if there's a plan to fix the iMACD() function. or if it's fine as it is, and I'm mistaken in the MACD construction method?

To reproduce the 'error', just build (or download from wherever) a MACD from scratch using iMA(), and compare it to iMACD() to see the difference (in values, the display is wrong too, but that matters much less in my opinion).

My understanding of MACD construction:
MACD main = ema12-ema26
MACD signal = ema9(MACD main)
Histogram = MACD main - MACD Signal
 
AUDUSD struggles to push higher

AUDUSD struggles to push higher

Minor support level found on this pair at 0.93273. Notice the strong buying at this point reaching as high as 0.93520. Now it is on its slow decent back down to its original level.  More and more buyers are closing out their trades, but it appears that's all. Since there is no sharp drop in price, it appears there are no new sellers.

avatar
Moderator
5714
stringo 2006.04.26 10:10 #
 
MACD signal is sma9(MACD main) not ema9
avatar
92
ququr 2006.04.26 20:54 #
 
Thanks Stringo. What about the function? It doesn't line up with sma9 either.

Also, are these guys wrong? I always thought MACD signal was ema9 of the MACD:

StockCharts.com "Usually, a 9-day EMA of MACD is plotted along side to act as a trigger line. "

Incredible Charts "signal line is calculated as a 9 day EMA of the MACD line."

Wikipedia "A signal or trigger line is then formed by smoothing this with a further EMA. The standard period for this is 9 days,"

Thanks!
-Matt
 
avatar
Moderator
5714
avatar
4
ecathell 2006.10.17 23:48 #
 
stringo wrote:
first see 'macd and macd histogram'
and try to change parameters

that is fine for an indicator but how do you apply that for an EA? I have an EA i am trying to get an IMACD to work in, I dont think its triggering my signals right.


I have fast=9 med=12 and slow of 52.



The MACD is Not right.

double getMACD()
{
return (iMA(NULL,0,MACD_Fast,0,MODE_EMA,PRICE_CLOSE,0)-iMA(NULL,0,MACD_Slow,0,MODE_EMA,PRICE_CLOSE,0));
//return (iMACD(NULL,0,MACD_Fast,MACD_Slow,MACD_Signal,PRICE_CLOSE,MODE_MAIN,0));
}
 
double getSignal()
{
return (iMACD(NULL,0,MACD_Fast,MACD_Slow,MACD_Signal,PRICE_CLOSE,MODE_SIGNAL,0));
}
 
double getRSI()
{
return (iRSI(NULL,0,RSI_Period,PRICE_CLOSE,0));
}
 
double getMAFast()
{
return (iMA(NULL,0,MA_Fast,0,MODE_EMA,PRICE_CLOSE,0));
}
 
double getMASlow()
{
return (iMA(NULL,0,MA_Slow,0,MODE_EMA,PRICE_CLOSE,0));
}
 
 
bool isBuySignal()
{
signal=getSignal();
macd=getMACD();
rsi=getRSI();
mafast=getMAFast();
maslow=getMASlow();

}
There isn't any way that I can really think to test the accuracy of my indicator with this workaround.
 
avatar
4
ecathell 2006.10.18 00:11 #
 
ecathell wrote:
stringo wrote:
first see 'macd and macd histogram'
and try to change parameters

that is fine for an indicator but how do you apply that for an EA? I have an EA i am trying to get an IMACD to work in, I dont think its triggering my signals right.


I have fast=9 med=12 and slow of 52.



The MACD is Not right.

double getMACD()
{
return (iMA(NULL,0,MACD_Fast,0,MODE_EMA,PRICE_CLOSE,0)-iMA(NULL,0,MACD_Slow,0,MODE_EMA,PRICE_CLOSE,0));
//return (iMACD(NULL,0,MACD_Fast,MACD_Slow,MACD_Signal,PRICE_CLOSE,MODE_MAIN,0));
}
 
double getSignal()
{
return (iMACD(NULL,0,MACD_Fast,MACD_Slow,MACD_Signal,PRICE_CLOSE,MODE_SIGNAL,0));
}
 
double getRSI()
{
return (iRSI(NULL,0,RSI_Period,PRICE_CLOSE,0));
}
 
double getMAFast()
{
return (iMA(NULL,0,MA_Fast,0,MODE_EMA,PRICE_CLOSE,0));
}
 
double getMASlow()
{
return (iMA(NULL,0,MA_Slow,0,MODE_EMA,PRICE_CLOSE,0));
}
 
 
bool isBuySignal()
{
signal=getSignal();
macd=getMACD();
rsi=getRSI();
mafast=getMAFast();
maslow=getMASlow();

}
There isn't any way that I can really think to test the accuracy of my indicator with this workaround.

Looking further I think I have found that IOsMA may be the real MACD as noted by other sites.
 
Back to topics list  

To add comments, please log in or register