Type A Bullish Divergence Code - Aussie Stock Forums

# Thread: Type A Bullish Divergence Code

1. ## Type A Bullish Divergence Code

Hi All, Wondering if someone has the code/script for Type A Bullish divergence on (RSI) for Metastock/Bull charts.

Has anyone done any testing with divergences?

Would appreciate any replies

Regards
Lenny

2. ## Re: TYPE A BULLISH DIVERGENCE CODE

Originally Posted by lenny
Hi All, Wondering if someone has the code/script for Type A Bullish divergence on (RSI) for Metastock/Bull charts.

Has anyone done any testing with divergences?

Would appreciate any replies

Regards
Lenny
Here is one from Jose.
{ Class A price/indicator divergence v3 }{ +1 signal = bullish trough divergences }{ -1 signal = bearish peak divergences }{ ©Copyright 2003 Jose Silva }{ josesilva22@yahoo.com }

ind:=Input("MACD=1, RSI=2, DMI=3, Mom=4",1,4,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);

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

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));

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));

0;
Ref(Trx AND Try AND Trx1<Trx2
AND Try1>Try2,shift)
-Ref((Pkx AND Pky AND Pkx1>Pkx2
AND Pky1<Pky2),shift)

3. ## Re: Type A Bullish Divergence Code

Thanks Tech/a
will have a play around with it.

Lenny

4. ## Re: Type A Bullish Divergence Code

lenny.
Im not a real fan of Divergence in isolation but you may wish to have a look at this thread

http://www.aussiestockforums.com/for...ght=Divergence

In the end 3 trades made good money but after the initial signal.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Aussie Stock Forums