DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIF,9);
MACD:=(DIF-DEA)*2,COLORSTICK;
N:=BARSLAST(CROSS(DEA,0));
VAR1:=LLV(DEA,N-2)>0 AND SUM(IF(REF(CROSS(DEA,DIF),1),1,0),N)=0 AND CROSS(DEA,DIF);
N1:=BARSLAST(VAR1);
VAR2:=LLV(DEA,N-2)>0 AND SUM(IF(REF(CROSS(DEA,DIF),1),1,0),N)=1 AND CROSS(DEA,DIF);
N2:=BARSLAST(VAR2);
减持:=VAR2 AND REF(DEA,N2+1)>REF(DEA,N1+1);
大减:=VAR2 AND REF(DEA,N2+1)<REF(DEA,N1+1) AND REF(C,N2+1)<REF(C,N1+1);
清仓:=VAR2 AND REF(DEA,N2+1)<REF(DEA,N1+1) AND REF(C,N2+1)>REF(C,N1+1);
BB1:=减持 OR 大减 OR 清仓;
小N:=BARSLAST(BB1);
YQXC:=SUM(IF(CROSS(0,DEA),1,0),小N)=1;
NN:=BARSLAST(CROSS(0,DEA));
VARB1:=HHV(DEA,NN-2)<0 AND SUM(IF(REF(CROSS(DIF,DEA),1),1,0),NN)=0 AND CROSS(DIF,DEA);
增持:VARB1 AND YQXC=1;