Zero Lag MACD for Amibroker (AFL)
anilbahi about 15 years ago Amibroker (AFL)
Fast indication of change in trend. Buy and sell signals are the same as the MACD crossover system
Indicator / Formula
Copy & Paste Friendly
_SECTION_BEGIN("Zero Lag MACD");
/*Xero Lag MACD(p,q,r)*/
//based on ZeroLag EMA - see Technical Analysis of Stocks and Commodities, April 2000
p = Param("P",12,3,36,2);
q = Param("Q",26,3,52,2);
r = Param("R",9,3,15,1);
EMA1= EMA(Close,p);
EMA2= EMA(EMA1,p);
Difference= EMA1 - EMA2;
ZeroLagEMAp= EMA1 + Difference;
//---------------------------------------
EMA1= EMA(Close,q);
EMA2= EMA(EMA1,q);
Difference= EMA1 - EMA2;
ZeroLagEMAq= EMA1 + Difference;
//---------------------------------------
ZeroLagMACD=ZeroLagEMAp - ZeroLagEMAq;
//---------------------------------------
// Signal line
EMA1= EMA(ZeroLagMACD,r);
EMA2= EMA(EMA1,r);
Difference= EMA1 - EMA2;
ZeroLagTRIG= EMA1 + Difference;
Plot(zerolagMACD,"",5,4);
Plot(zerolagtrig,"",colorCustom12,4);
HistInd = zerolagMACD - zerolagtrig;
scHistMax = LastValue(HHV(HistInd,
BarsSince( Status("barvisible") AND NOT Ref(Status("barvisible"),-1) )));
scHistMin = LastValue(LLV(HistInd,
BarsSince( Status("barvisible") AND NOT Ref(Status("barvisible"),-1) )));
scaleHist = Max( abs(scHistMax), abs(scHistMin) );
Plot(HistInd, _DEFAULT_NAME(),
IIf(HistInd>=0, ParamColor("Up Color", colorGreen), ParamColor("Down Color", colorRed)),
ParamStyle( "Style", styleHistogram | styleThick, maskHistogram )
);
Plot( 0, "", colorBlue, styleLine);
//===========================end zeroLagMACD
_SECTION_END();1 comments
Leave Comment
Please login here to leave a comment.
Good