N:=3;{N的值表示0轴下第几个金叉,任选}
M:=(N-1);
DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIF,9);
A2:=IF(CROSS(DEA,0),1,0);
A12:=IF(DIF<0 AND CROSS(DIF,DEA),1,0);
SS2:=IF(A2,SUM(A12,0),0);
SSB2:=HHV(SS2,0);
SSS2:=SUM(A12,0);
轴下第N次金叉:IF(SSS2-SSB2>M AND SSS2>REF(SSS2,1),1,0);