DIF:=100*(EMA(CLOSE,12)-EMA(CLOSE,26));
DEA:=EMA(DIF,9);
MACD:=(DIF-DEA)*2;
ZSC:=CROSS(DEA#WEEK,DIF#WEEK);
ZSC1:=CROSS(DEA,DIF);
PC:=IF(EXISTR(ZSC,7,1),0,1);
PC1:=IF(EXISTR(ZSC1,7,1),0,1);
Q1:=MACD<0 AND MACD>REF(MACD ,1) AND
REF(MACD ,1)<REF(MACD ,2) AND REF(MACD ,2)<REF(MACD ,3)
AND REF(MACD ,3)<REF(MACD ,4);
SCL:=EXISTR(CROSS(DEA,DIF),9,1);
C1:=BARSLAST(REF(Q1,1));
C2:REF(MACD,C1+1)<MACD AND Q1 AND DIF<0 ;