MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

A B C D E F G H I J K L M N O P R S T U V W Y Z #

MACD - Composite EMA by Jose Silva
Normalized MACD oscillator based on composite multi-EMA's - with auto over-bought/sold levels.

MACD - Composite EMA by Jose Silva

{ 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 }

 

Source / From: TOP
http://www.metastocktools.com

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.

TradeStation® Pro, TradeStation® 2000i, OptionStation®, SuperCharts®, PowerEditor® and EasyLanguage®
are registered trademarks of TradeStation Technologies, Inc. Other names and marks referred to are the property of their respective owners.

All information provided on this website is for educational purposes only. Trading involves risk, including possible loss of principal and other losses.

Ten i inne materiały na tej stronie zostały zamieszczone zostały jedynie w celach edukacyjnych, nie ponoszę żadnej odpowiedzialno¶ci za ich stosowanie.

Gra na giełdzie i rynkach walutowych (FOREX) niesie ze sob± ryzyko poważnych strat finansowych!