[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Generic MACD



PureBytes Links

Trading Reference Links

>
>
I believe this is the code for a "generic" MACD. I broke it into three 
parts following advice given to me here. Doing so makes it easier for me 
to identify the plots. Note: I didn't plot the 0 line in the function. I 
like to use red for the 0 and green for the histo in that plot.

MyMACD
{Plots the MACD line}
ShMA:=Input("ShMAperiods" ,2,50,5);
LoMA:= Input("LoMAperiods" ,2,50,35);
MyMACD:= Mov(C,ShMA,E)-Mov(C,LoMA,E);
MyMACD;

MyMACDSignal

{Plots the MACD signal line)
ShMA:= Input("ShortPeriods",2,50,5);
LoMA:= Input("LongPeriods",2,50,35);
SigMA:=Input("SignalPeriods",2,50,5);
MyMACD:= Mov(C,ShMA,E)-Mov(C,LoMA,E);
MySignal:= Mov(MyMACD,SigMA,E);
MySignal;

{MyMACDHisto plots a MACD Histogram, when histogram style is used}
ShMA:= Input("ShortPeriods",2,50,5);
LoMA:= Input("LongPeriods",2,50,35);
SigMA:=Input("SignalPeriods",2,50,5);
MyMACD:= Mov(C,ShMA,E)-Mov(C,LoMA,E);
MySignal:= Mov(MyMACD,SigMA,E);
MyHisto:= MyMACD-MySignal;
MyHisto;

Ron