{ Copyright (c) 2004, John Bruns and Financial Trading Inc. }
macShort:=Input("Short MA",1,100,12);
macLong:=Input("Long MA",1,100,26);
macSmooth:=Input("Smoothing Period",1,100,9);
macTime:=Input("Time Ratio",1,22,1);
macFactor:=2; { Histogram Scaling Factor }
macShort:=macShort*macTime;
macLong:=macLong*macTime;
macSmooth:=macSmooth*macTime;
mac:=Mov(C,macShort,E)-Mov(C,macLong,E);
MacSig:=Mov(mac,macSmooth,E);
macplot:=MacFactor*(mac-MacSig);
{note the absolute value of the plot is multiplied by a factor so that it is readable in a window with the standard MACD line plot overlaid on the same axis.}
If(macplot >= Ref(macplot,-macTime), macplot,0);
If(macplot >= Ref(macplot,-macTime), 0, macplot);
mac;
macSig;
|