VAR0:=(CLOSE*2+HIGH+LOW)/4*vol;
var1:=SUM(VAR0,89)/SUM(vol,89);
var2:=IF(COUNT(VAR0>0,2)>=2,MA(CLOSE,89)*(1+(MA(VAR0,89)/REF(MA(VAR0,89),1)-1)/21),MA(CLOSE,89));
var3:=IF(COUNT(ABS(CLOSE-var1)>21,8)>=1 AND COUNT(CLOSE/REF(CLOSE,1)<0.8,8)<1 AND COUNT(VAR0>0,2)>=2,10,0);
var4:=IF(CLOSE>=var1 AND COUNT(VAR0>0,2)>=2,var1*1.001,IF(VAR0<0.1 AND COUNT(VAR0>0,2)<1.5,MA(CLOSE,89),var1*0.999));
var5:=IF(var3>0,var2,var4);
var6:=MA(CLOSE,89);
a:IF(var5/REF(var5,1)>1.1 OR var5/REF(var5,1)<0.9,VAR6,VAR5);
bs:IF(var5/REF(var5,1)>1.1 OR var5/REF(var5,1)<0.9,VAR6,VAR5);
FL:MA(CLOSE,17)+ABS(MA(CLOSE,17)-REF(MA(CLOSE,17),1));
FS:MA(CLOSE,17)+MA(CLOSE,17)-REF(MA(CLOSE,17),1);
CG:IF(MA(CLOSE,17)<FS,FS,MA(CLOSE,17));