N:=13;M:=3;P:=40;
DIF:=EMA(CLOSE,6)-EMA(CLOSE,13);
DEA:=EMA(DIF,5);
A2:=IF(crOSS(0,DEA),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);
轴上第1次金叉:=IF(SSS2-SSB2=1 AND SSS2>REF(SSS2,1),1,0);
红箭头:轴上第1次金叉;