METASTOCK EXPLORATION CODE

PERIOD:=22;
PERS:=40;
COEF:=0.1;
INTRA:=Log(H) - Log(L);
VINTRA:=Stdev(INTRA, PERIOD);
INTER:=Log(Typical()) - Log(Ref(Typical(), -1));
VINTER:=Stdev(INTER, PERIOD);
CUTOFF:=COEF*(VINTER + VINTRA)*C;
MF:=C - (H + L)/2 + Typical() - Ref(Typical(), -1);

FVE:=Sum(If(MF > CUTOFF, +V, If(MF < -CUTOFF, -V, 0)), PERIOD)/Mov(V,PERIOD,S)/PERIOD*100;

FVE12:=Sum(If(MF > CUTOFF, +V, If(MF < CUTOFF/100, -V, 0)), 12)/Mov(V,12,S)/12*100;

CBOL:=1+((C - BBandBot(C, PERS, S, 2))/(BBandTop(C, PERS, S, 2) - BBandBot(C, PERS, S, 2)));

INDBOL:=1+((FVE - BBandBot(FVE, PERS, S, 2))/(BBandTop(FVE, PERS, S, 2) - BBandBot(FVE, PERS, S, 2)));

DIVERG1:=(INDBOL - CBOL)/cbol*100;

diverg:=Mov(diverg1, 3, E);

MACDH:=MACD() - Mov(MACD(), 9, E);

FVE>-15 AND FVE<20 AND diverg>30 AND LinRegSlope(FVE,15)>0.6 AND LinRegSlope(FVE12,15)>0.5 AND FVE12>Ref(FVE12,-1) AND MACDH>0