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 #

Divergences - Class A by Jose Silva

Divergences - Class A

{ Class A price/indicator divergence v4.1

+1 signal = bullish trough divergences.
-1 signal = bearish peak divergences.

ŠCopyright 2004-2006 Jose Silva.
For personal use only.
http://www.metastocktools.com }

{ User inputs }
ind:=Input("MACD=1, Stoch=2, RSI=3, DMI=4, Mom=5",1,5,1);
pds:=Input("Indicator periods",2,2520,10);
f:=Input("Price field: Close=1, High/Low=2",
1,2,1);
Ch:=Input("Peak/Trough depth minimum (0-100%)",
0,100,0)/100;
shift:=Input("Shift signals back to match divergences=1",0,1,0);

{ Select divergence indicator }
{y:=insert any indicator or Fml("formula name")}
y:=If(ind=1,MACD(),
If(ind=2,Stoch(pds,3),
If(ind=3,RSI(pds),
If(ind=4,DMI(C),
Mo(pds)))));

{ Price peaks/troughs }
xu:=If(f=1,C,H);
xd:=If(f=1,C,L);
Pkx:=xu<Ref(xu,-1) AND Ref(xu,-1)>Ref(xu,-2)
AND Ref(xu,-1)>=(xu+Ref(xu,-2))/2*(1+Ch);
Pkx1:=ValueWhen(1,Pkx,Ref(xu,-1));
Pkx2:=ValueWhen(2,Pkx,Ref(xu,-1));
Trx:=xd>Ref(xd,-1) AND Ref(xd,-1)<Ref(xd,-2)
AND Ref(xd,-1)<=(xd+Ref(xd,-2))/2*(1-Ch);
Trx1:=ValueWhen(1,Trx,Ref(xd,-1));
Trx2:=ValueWhen(2,Trx,Ref(xd,-1));

{ Indicator peaks/troughs }
Pky:=y<Ref(y,-1) AND Ref(y,-1)>Ref(y,-2)
AND Ref(y,-1)>=(y+Ref(y,-2))/2*(1+Ch);
Pky1:=ValueWhen(1,Pky,Ref(y,-1));
Pky2:=ValueWhen(2,Pky,Ref(y,-1));
Try:=y>Ref(y,-1) AND Ref(y,-1)<Ref(y,-2)
AND Ref(y,-1)<=(y+Ref(y,-2))/2*(1-Ch);
Try1:=ValueWhen(1,Try,Ref(y,-1));
Try2:=ValueWhen(2,Try,Ref(y,-1));

{ Plot signals in own window }
0;
Ref(Trx AND Try AND Trx1<Trx2
AND Try1>Try2,shift)
-Ref((Pkx AND Pky AND Pkx1>Pkx2
AND Pky1<Pky2),shift)

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!