Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
OK pittsburgh,
Lets see how many different MA and therefore MACD variations are out there....
Here is just a small collection of some of the stuff I have. I have some more, but they are basically the same as what's already here. There are literally hundreds (if not thousands) of variations. You could spend a lifetime looking, but ...
Hope these help.
wabbit :D
P.S. To all others lets see how much we can collect?!
P.P.S. Then all we need is someone to collate them all. Any volunteers?
P.P.P.S. If I am missing any copyrights, please let me know.
----8<------------------------------------------------------------------------------
{dieselpr MACD}
pds:=2;
XAT:=2;
{Zero Lag MA}
EMA8:=Mov(2*(Mov(C,8/2,W))-Mov(C,8,W),2,W);
EMA17:=Mov(2*(Mov(C,17/2,W))-Mov(C,17,W),4,W);
myMACD:=EMA8-EMA17;
myTrigger:=Mov(myMACD,9,E);
{Buy & Sell Exit Alerts}
LE:=HHV(H-XAT*ATR(5),10);{For Long}
SE:=LLV(L+(XAT*2)*ATR(5),10);{For Short}
{Long Trades Section}
nLong:=myMACD>myTrigger AND Alert(myMACD<myTrigger,pds);
xLong:=(L<LE AND Alert(L>LE,pds)) OR (L<HHV(H - (XAT*2)*ATR(5),10) AND Alert(L>HHV(H - (XAT*2)*ATR(5),10),pds));
I:=Cum(nLong+xLong>-1)=1;
Long:=BarsSince(I OR nLong)<BarsSince(I OR xLong);
{Short Trades Section}
nShort:=myMACD<myTrigger AND Alert(myMACD>myTrigger,pds);
xShort:=(H>SE AND Alert(H<SE,pds)) OR (H>LLV(L + (XAT*2)*ATR(5),10) AND Alert(H<LLV(L + (XAT*2)*ATR(5),10),pds));
I:=Cum(nShort+xShort>-1)=1;
Short:=BarsSince(I OR nShort)<BarsSince(I OR xShort);
{plot as line}
0;
{plot as histograms}
Long;
-Short;
----8<------------------------------------------------------------------------------
{Hull Moving Average}
period:=Input("Period",1,200,20) ;
sqrtperiod:=LastValue(Int(Sqrt(period)));
Mov(2*(Mov(C,period/2,W))-Mov(C,period,W),sqrtperiod,W);
----8<------------------------------------------------------------------------------
{Kaufman's Adaptive Moving Average}
Periods:=Input("Time Periods",1,1000, 5);
Direction := ROC(CLOSE,periods,$);
Volatility := Sum(Abs(ROC(CLOSE,1,$)),periods);
ER := Abs(Direction/Volatility);
FastSC := 2/3;
SlowSC := 2/30;
SSC := ER * (FastSC - SlowSC) + SlowSC;
Constant := Pwr(SSC,2);
AMA:=If(Cum(1)=periods +1,Ref(C,-1)+constant*(C-Ref(C,-1)),
PREV*(1-Constant)+C*Constant);
AMA;
----8<------------------------------------------------------------------------------
{SMB - Mod. Kaufman's Adaptive Moving Average}
prd:=Input("Time Periods",1,1000,31);
K:=Power(ROC(CLOSE,prd,$)/Sum(Abs(ROC(CLOSE,1,$)),prd),2);
If(Cum(1)<=prd+1,C,PREV*(1-K)+C*K);
----8<------------------------------------------------------------------------------
{MACD - DEMA Smoothed}
shortperiods:=Input("Enter the shorter DEMA periods: ",3,20,12);
longperiods:=Input("Enter the longer DEMA periods: ",21,50,26);
signal:=Input("Enter the number of signal line periods: ",3,50,9);
Dema(C,shortperiods)-Dema(C,longperiods);
Mov(Dema(C,shortperiods)-Dema(C,longperiods),signal,E);
----8<------------------------------------------------------------------------------
{MACD - TEMA Smoothed}
shortperiods:=Input("Enter the shorter TEMA periods: ",3,20,12);
longperiods:=Input("Enter the longer TEMA periods: ",21,50,26);
signal:=Input("Enter the number of signal line periods: ",3,50,9);
Tema(C,shortperiods)-Tema(C,longperiods);
Mov(Tema(C,shortperiods) - Tema(C,longperiods),signal,E);
----8<------------------------------------------------------------------------------
{MS2005 - Zero Lag MACD}
EMA121:=Mov(C,12,E);
EMA122:=Mov(EMA121,12,E);
Difference12:=EMA121-EMA122;
ZEMA12:=EMA121+Difference12;
EMA261:=Mov(C,26,E);
EMA262:=Mov(EMA261,26,E);
Difference26:=EMA261-EMA262;
ZEMA26:=EMA261+Difference26;
MyIndicator:=ZEMA12-ZEMA26;
Mov(MyIndicator,9,E);
MyIndicator;
----8<------------------------------------------------------------------------------
{SMB - Lagless MA}
prd:=Input("Periods",1,250,21);
2*Mov(C,prd,E)-Mov(Mov(C,prd,E),prd,E);
----8<------------------------------------------------------------------------------
{ MACD or Histogram based on multiple EMA's }
{ Incorporating automatic overbought/oversold levels }
{ ©Copyright 2005 Jose Silva }
{ http://www.metastocktools.com }
{ User inputs }
plot1:=Input("[1]MACD, [2]Histogram",1,2,1);
plot2:=Input("[1]MACD/Hist, [2]Normalized",
1,2,1);
pds:=Input("Signal/Histogram EMA periods",
2,260,21);
{ Composite-EMA MACD/Histogram }
ema1:=Mov(C,3,E)+Mov(C,5,E)+Mov(C,8,E)+Mov(C,11,E)+Mov(C,14,E)+Mov(C,17,E);
ema2:=Mov(C,30,E)+Mov(C,35,E)+Mov(C,40,E)+Mov(C,45,E)+Mov(C,50,E)+Mov(C,56,E);
emaComp:=ema1-ema2;
signal:=Mov(emaComp,pds,E);
hist:=emaComp-signal;
{ Choose MACD or Histogram }
MacdH:=If(plot1=1,emaComp,hist);
{ Normalized MACD/Histogram }
normMod:=Highest(MacdH)-Lowest(MacdH);
normMod:=If(normMod=0,.000001,normMod);
MacdHnorm:=((MacdH-Lowest(MacdH))/normMod-.5)*200;
{ Choose standard/normalized }
MacdComp:=If(plot2=1,MacdH,MacdHnorm);
signal:=Mov(MacdComp,pds,E);
{ MACD/Hist average }
avg:=Cum(MacdComp)/Cum(IsDefined(MacdComp));
{ MACD/Hist auto boundaries }
pk:=Ref(MacdComp,-1)>MacdComp AND Ref(MacdComp,-1)>Ref(MacdComp,-2) AND Ref(MacdComp,-1)>avg;
pkVal:=ValueWhen(1,pk,Ref(MacdComp,-1));
tr:=Ref(MacdComp,-1)<MacdComp AND Ref(MacdComp,-1)<Ref(MacdComp,-2) AND Ref(MacdComp,-1)<avg;
trVal:=ValueWhen(1,tr,Ref(MacdComp,-1));
Obought:=Cum(pkVal)/Cum(IsDefined(pkVal));
Osold:=Cum(trVal)/Cum(IsDefined(trVal));
{ Plot in own window }
Obought; { Red }
avg; { Grey }
Osold; { Blue }
If(plot1=1,signal,avg); { Green }
MacdComp { Black }
----8<------------------------------------------------------------------------------
{ Normalized MACD % & histogram v3.0, -100~+100% }
{ ©Copyright 2003-2004 Jose Silva }
{ http://www.metastocktools.com }
pds1:=Input("short EMA periods",1,252,12);
pds2:=Input("long EMA periods",2,2520,252);
pds3:=Input("MACD trigger signal periods",1,252,9);
pds4:=Input("normalizing periods (1=none)", 1,2520,252);
x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,4);
plot:=Input("MACD=1, Histogram=2, trigger crossover Signals=3",1,3,1);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
sht:=Mov(x,pds1,E);
lng:=Mov(x,pds2,E);
ratio:=Min(sht,lng)/Max(sht,lng);
Mac:=(If(sht>lng,2-ratio,ratio)-1)*100;
MacNorm:=(Mac-LLV(Mac,pds4))/(HHV(Mac,pds4)-LLV(Mac,pds4)+.000001)*100;
MacNorm:=If(pds4<2,Mac,MacNorm);
trigger:=Mov(MacNorm,pds3,E);
hist:=MacNorm-trigger;
signals:=Cross(MacNorm,trigger)-Cross(trigger,MacNorm);
If(plot=1,trigger,0);
If(plot=3,signals,If(plot=2,hist,MacNorm))
----8<------------------------------------------------------------------------------
|