Skip to main content

Zero Lag MACD for Amibroker (AFL)

kaiji over 16 years ago Amibroker (AFL)

  • Rating:
    5 / 5 (Votes 1)
  • Tags:
    macd, amibroker, histogram

Here is a Zero Lag MACD. You can use the parameter capability to tweak the periods. In comparison to Amibroker’s built in MACD, Zero Lag MACD signals show up a few days earlier, and divergences are quite pronounced.

Indicator / Formula

Copy & Paste Friendly
p = Param("P",12,3,40,2);
q = Param("Q",26,3,60,2);
r = Param("R",9,3,15,1);

function zeroLagEMA(array, p)
{
	ema1= EMA(array,p);
	ema2= EMA(ema1,p);
	diff = ema1 - ema2;
	return ema1 + diff;
}

zeroLagMACD = zeroLagEMA(C, p) - zeroLagEMA(C, q);
Plot(zeroLagMACD, _DEFAULT_NAME(), colorRed);
Plot(zeroLagEMA(zeroLagMACD, r), _DEFAULT_NAME(), colorBlue);

0 comments

Leave Comment

Please login here to leave a comment.