VAR0:=IF((HIGH OR LOW),CLOSE*VOL,(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);
BS:IF(var5/REF(var5,1)>1.1 OR var5/REF(var5,1)<0.9,VAR6,VAR5);