PureBytes Links
Trading Reference Links
|
Jay,
You can easily modify "Divergence v3" from
http://users.bigpond.com/prominex/pegasus.htm#metastock
=======================
Divergences - Class A(2)
=======================
---8<---------------------------
{Class A price/indicator divergence v3(2)}
{+1 signal = bullish trough divergences}
{-1 signal = bearish peak divergences}
{©Copyright 2003 Jose Silva}
{ http://users.bigpond.com/prominex/pegasus.htm }
{Class A price/indicator divergence v3(a)}
{+1 signal = bullish trough divergences}
{-1 signal = bearish peak divergences}
{©Copyright 2003 Jose Silva}
{josesilva22@xxxxxxxxx}
ind:=Input("5EMA-15EMA=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,Mov(C,5,E)-Mov(C,15,E),
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)*-1,shift)
---8<---------------------------
jose '-)
> About a year or so ago Stocks and Commodities magazine published a
good
> article on the 5 minus 15 MA - exponential. When it displays
divergence between
> the average and the price trend it has an uncanny ability to predict
price
> changes. While I can code the 5 - 15, I've been unable to code a
divergence
> Exploration or back test.
>
> Jay
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Metastockusers/
<*> To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|