MQL4 - automated forex trading   /  

Forum

Login | Register | Language: ru cn en
MetaTrader Market: we have 650 Expert Advisors for algorithmic trading!

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
 
Outlook for the pair audusd
Outlook for the pair audusd
Vasilii Apostolidi | 21 December 2014, 17:54 | Views: 69
My A Trend indicator shows that there is a tendency for sale. The strength of the USD currency is significantly higher AUD. Levels of support for the pair: 0.8144, 0.8120, 0.8081 Resistance levels for the pair: 0.8191, 0.8215, 0.8254 My opinion: We consider the options of sales, with an eye on economic news from the US.
avatar
Moderator
5782
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
5782
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