FIGURE 7: AIQ. Here is a sample chart of VIAB with MACDhist, the color bars, and the 34- and 55-bar EMAs.
Figure 7 shows the MACD histogram on a chart of Viacom (VIAB) with the color bars and the 34- and 55-bar exponential moving averages (EMA). Note that I did not code the weighted moving average (WMA) but substituted the EMA for the WMA. I chose to view the chart of VIAB by running the EDS “Zero MACD.eds” on 3/14/2016 and examining the alert messages on the report “List.” VIAB is the only one on that date that showed a cross up on the MACDhist (see Figure 8 for a look at part of this report for 3/14/2016).
FIGURE 8: AIQ. This shows part of the EDS custom report “List” that shows the MACDhist values on 3/14/2016, the color status, and any alerts that were generated for that day.
! ZERO IN ON THE MACD
! Author: Barbara Star, TASC May 2016
! Coded by: Richard Denning 3/14/16
! www.TradersEdgeSystems.com
! INPUTS:
macd1 is 12.
macd2 is 26.
macdSig is 1.
! INDICATORS:
emaST is expavg([Close],macd1).
emaLT is expavg([Close],macd2).
MACD is emaST - emaLT. ! MACD line
SigMACD is expavg(MACD,macdSig). ! MACD Signal line
MACDosc is MACD - SigMACD. ! MACD Oscillator
HD if hasdatafor(macd2) = macd2.
MACDhist is MACD. ! plot as historigram
MACDblue if MACDhist > 0. ! use these rules to color MACDhist
MACDred if MACDhist < 0. ! use these rules to color MACDhist
MACDcolor is iff(MACDblue and HD,"Blue",iff(MACDred and HD,"Red","White")). !for report list
List if 1.
!ALERTS:
EMA1 is expavg([close],34).
EMA2 is expavg([close],55).
xupEMA1 if [close] > EMA1 and valrule([close] < EMA1,1).
xdnEMA1 if [close] < EMA1 and valrule([close] > EMA1,1).
xupEMA2 if [close] > EMA2 and valrule([close] < EMA2,1).
xdnEMA2 if [close] < EMA2 and valrule([close] > EMA2,1).
xupMACD if MACDhist > 0 and valrule(MACDhist < 0,1).
xdnMACD if MACDhist < 0 and valrule(MACDhist > 0,1).
UpAlerts is iff(xupEMA1,"xupEMA1",iff(xupEMA2,"xupEMA2",iff(xupMACD,"xupMACD"," "))).
DnAlerts is iff(xdnEMA1,"xdnEMA1",iff(xdnEMA2,"xdnEMA2",iff(xdnMACD,"xdnMACD"," "))).