DEA:=EMA(DIFF,9);
a 1:= bars last(REF(CROSS(DIFF,DEA), 1));
Bottom deviation: REF(CLOSE, A 1+ 1) > close and distinguish & gtREF(DIFF, A 1+ 1) and CROSS(DIFF, DEA);