hi
I found ths metastock formula for diversion in price and MACD RSI and DMI indicator but i dont now how to use it. I posted this whole thing in explorer but it didnt worked metastock is telling that this function cant be used this way some thing like that.
will some body please tell me the procesure of it
Warm regards
Ali
P.S. for more formulas go to meta-formula (dot) com
the formula
{ Class A price/indicator divergence v3 }{ +1 signal = bullish trough divergences }{ -1 signal = bearish peak divergences }
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)
I found ths metastock formula for diversion in price and MACD RSI and DMI indicator but i dont now how to use it. I posted this whole thing in explorer but it didnt worked metastock is telling that this function cant be used this way some thing like that.
will some body please tell me the procesure of it
Warm regards
Ali
P.S. for more formulas go to meta-formula (dot) com
the formula
{ Class A price/indicator divergence v3 }{ +1 signal = bullish trough divergences }{ -1 signal = bearish peak divergences }
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)
Last edited: