FF:=IF(Abs(L-ma(C,47))/MA(C,47)>ABS(REF(L,1)-REF(MA(C,47),1))/REF(MA(C,47),1),ABS(REF(L,1)-REF(MA(C,47),1))/REF(MA(C,47),1),ABS(L-MA(C,47))/MA(C,47));
FF1:=IF(ABS(REF(L,1)-REF(MA(C,47),1))/REF(MA(C,47),1)>ABS(REF(L,2)-REF(MA(C,47),2))/REF(MA(C,47),2),ABS(REF(L,2)-REF(MA(C,47),2))/REF(MA(C,47),2),FF);
FF2:=IF(FF1>ABS(REF(L,3)-REF(MA(C,47),3))/REF(MA(C,47),3),ABS(REF(L,3)-REF(MA(C,47),3))/REF(MA(C,47),3),FF1);
FF3:=IF(FF2>ABS(REF(L,4)-REF(MA(C,47),4))/REF(MA(C,47),4),ABS(REF(L,4)-REF(MA(C,47),4))/REF(MA(C,47),4),FF2);
FF4:=IF(FF3>ABS(REF(L,5)-REF(MA(C,47),5))/REF(MA(C,47),5),ABS(REF(L,5)-REF(MA(C,47),5))/REF(MA(C,47),5),FF3);
FF5:=IF((HHV(ABS(((HHV(CLOSE,6)/LLV(CLOSE,6))-1)),6)>(10/100)),3,6);
FF6:=IF((MINUTE=5),FF5*48,IF((MINUTE=15),FF5*16,IF((MINUTE=30),FF5*8,IF((MINUTE=60),FF5*4,FF5))));
FF7:=IF( vol=0,MA(CLOSE,FF6),((SUM(AMOUNT,FF6)/SUM(VOL,FF6))/100));
crOSS(CLOSE,REF(FF7,1)) AND REF(C,2)<=REF(MA(C,18),2) AND REF(C,2)>=REF(MA(C,47),2) AND FF4<0.02 AND
CROSS(C,MA(C,18)) AND V>REF(V,1) AND REF(C>O,1);