this is the metastock formula for Class A Diversion

#1
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)
 
Last edited:
#4
sorry guy's
earliar for got add formula now i edited it in my fist post

and here it is once again

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

wating for your replay
Warm regards
Ali
 

rkkarnani

Well-Known Member
#5
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)
The formula does not seem to be for Exploration.... Copy paste the same in Indiactor Builder and create a New indicator.
 

Similar threads