AIQ: REVERSING MACD

The AIQ code for the reverse MACD functions and indicators described in Johnny Dough’s article in the Decmber issue of Stocks & Commodities, “Reversing MACD,” is provided at the following website: www.TradersEdgeSystems.com/traderstips.htm, and is also shown below.

In the figure blow, I show a chart of Green Mountain Coffee Inc. with the two PMAC indicators and the MACD indicators. The cyan line is the PMACzero, which is the price tomorrow that would have to be attained for the MACD to equal zero. This indicator has wide swings because sometimes a big move in price is needed to bring the MACD back to zero. The purple line shows the PMACeq indicator, which shows tomorrow’s price that would make MACD the same as it was today. It stays close to the current price. The lower panel shows the MACD (white) and the MACD signal (yellow) indicators.
AIQ SYSTEMS, REVERSING MACD. Here is an example of the PMACzero (cyan) and PMACeq (purple) indicators on a chart of Green Mountain Coffee Inc. with MACD (white) and MACD signal line (yellow) indicators (lower panel).
 !REVERSING MACD
!Author: Johnny Dough, TASC January 2012
!Coded by: Richard Denning 11/9/2011
!www.TradersEdgeSystems.com

!ABBREVIATIONS:
C is [close].
H is [high].
L is [low].
O is [open].

!INPUTS:
mfast is 12.
mslow is 26.
msig is 9.

!UDFs:
emaFast is expavg(C,mfast).
emaSlow is expavg(C,mslow).
MACD is emaFast – emaSlow.
sigMACD is expavg(MACD,msig).
len_X is mfast.
len_Y is mslow.
lvl is sigMACD.
alphaX is 2 / (1 + len_X).
alphaY is 2 / (1 + len_Y).

!PLOT THE FOLLOWING AS SINGLE LINE INDICATOR ON PRICE CHART:
PMACDeq is (expavg(C,len_X)*alphaX
   -expavg(C,len_Y)*alphaY)/(alphaX-alphaY).

one_alphaX is 1 – alphaX.
one_alphaY is 1 – alphaY.
PMACDlvl is (lvl+expavg(C,len_Y)*one_alphaY
   – expavg(C,len_X)*one_alphaX)/(alphaX-alphaY).

!PLOT THE FOLLOWING AS SINGLE LINE INDICATOR ON UPPER CHART:
PMACDzero is (0+expavg(C,len_Y)*one_alphaY
   – expavg(C,len_X)*one_alphaX)/(alphaX-alphaY).

Leave a Reply