M:=9;
SHORT:=12;
LONG:=26;
MID:=9;
DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIF,9);
macdD:=(DIF-DEA)*2;
P:=BArslAST(crOSS(DIF,0.01))+1;
PER03:=BARSLAST(CROSS(DIF,DEA));
PER05:=BARSLAST(CROSS(DEA,DIF));
AA:=VALUEWHEN(CROSS(DIF,DEA),DEA);
间隔A:=PER03;
间隔B:=REF(BARSLAST(CROSS(DIF,DEA)),间隔A+1);
间隔E:=REF(BARSLAST(CROSS(DIF,DEA)),间隔B+间隔A+2);
间隔C:=PER05;
间隔D:=REF(BARSLAST(CROSS(DEA,DIF)),间隔C+1);
似锦距离1:=间隔C-间隔A;
似锦距离2:=间隔D+间隔C+1-(间隔B+间隔A+1);
上上次金叉:=间隔A+间隔B+1;
上次金叉:=PER03;
CCC1:=FINDLOW(L,间隔A,间隔B+1,1);
CCC2:=FINDLOW(L,间隔B+1,间隔B+间隔E+1,1);
CC1:=IF(似锦距离1<=3,CCC1,FINDLOW(L,上次金叉,似锦距离1+1,1));
CC2:=IF(似锦距离2<=3,CCC2,FINDLOW(L,上上次金叉,似锦距离2+2,1));
站上三十:=BARSLAST(C>MA(C,30));
PER8:=IF(BARSLAST(CROSS(DIF,DEA))<=1,1,BARSLAST(CROSS(DIF,DEA)));
PER9:=COUNT(C>MA(C,30),PER03+1);
PER10:=BARSLAST(PER9=1);
A1:=REF(DIF,PER8+1);A2:=REF(DIF,PER8);
B1:=REF(DEA,PER8+1);B2:=REF(DEA,PER8);
JD:=((A1+A2)/2+(B1+B2)/2)/2;
XG2:=EVERY(DIF>DEA,PER8);
XG4:=(REF(DIF,PER8)<1.1*REF(MacDD,PER8));
XG5:=CC1<CC2;
XG6:=站上三十<PER03+1;
XG7:=AA>REF(AA,PER8+1);
XG10:=(XG2 AND XG4 AND XG5 AND XG6 AND XG7);
XG11:=BARSLASTCOUNT(C>MA(C,20))>9 AND XG10;
PP:=BARSLAST(REF(XG11,1)>0 AND XG11=0)<=5;
线618:=(HHV(H,PER03+1)-CC1)*0.618+CC1;
线382:=(HHV(H,PER03+1)-CC1)*0.382+CC1;
XG:BARSLAST(XG11)<PER03+1 AND (CROSS(线618,L) OR CROSS(线382,L));