DIFF:EMA(CLOSE,6)-EMA(CLOSE,13);
DEA:EMA(DIFF,5);
macd:(DIFF-DEA)*2,COLORSTICK;
HJ_4:=BArslAST(REF(crOSS(DEA,DIFF),1));
HJ_5:=REF(CLOSE,HJ_4+1)<CLOSE AND REF(DIFF,HJ_4+1)>DIFF;
HJ_6:=HJ_5 AND CROSS(DEA,DIFF) AND HJ_4>10 AND HJ_4<50;
HJ_7:=BARSLAST(REF(CROSS(DIFF,DEA),1));
HJ_8:=REF(CLOSE,HJ_7+1)>CLOSE AND REF(DIFF,HJ_7+1)<DIFF;
HJ_9:=HJ_8 AND CROSS(DIFF,DEA) AND HJ_7>10 AND HJ_7<50;
HJ_10:=CROSS(DIFF,DEA) AND DIFF<(-0.1);
HJ_11:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
HJ_12:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(HJ_11=2,21)=1;
HJ_13:=MA(CLOSE,60);
HJ_14:=HJ_13/15;
HJ_20:=CROSS(DEA,DIFF) AND DIFF>(0.1);
HJ_21:=COUNT(CROSS(DEA,DIFF),BARSLAST(DEA<=0));
HJ_22:=CROSS(DEA,DIFF) AND DEA>0 AND COUNT(HJ_21=2,21)=1;
底背离:HJ_9,NODRAW,COLORYELLOW,LINETHICK3;
低位金叉:HJ_10,NODRAW,COLORRED,LINETHICK3;
二次金叉:HJ_12,NODRAW,COLORMAGENTA,LINETHICK3;
顶背离:HJ_6,NODRAW,COLOR00F000,LINETHICK3;
高位死叉:HJ_20,NODRAW,COLORFF8000,LINETHICK3;
二次死叉:HJ_22,NODRAW,COLORFF0000,LINETHICK3;
HJ_15:=HJ_9 AND HJ_12 AND HJ_10;
前一最佳:BARSLAST(REF(HJ_15,1))+1,NODRAW,COLORWHITE;
DRAWICON(CROSS(DIFF,DEA),DIFF,1);
DRAWICON(CROSS(DEA,DIFF),DIFF,2);
STICKLINE(HJ_6,HJ_14*0.011,HJ_14*0.09,2,0),COLOR00F000;
STICKLINE(HJ_9,HJ_14*(-0.02),HJ_14*(-0.1),2,0),COLORYELLOW;
STICKLINE(HJ_10,HJ_14*0.011,HJ_14*0.09,2,0),COLORRED;
STICKLINE(HJ_12,HJ_14*0.125,HJ_14*0.2,2,0),COLORMAGENTA;
STICKLINE(HJ_20,HJ_14*0.011,HJ_14*0.09,2,0),COLORFFFF00;
STICKLINE(HJ_22,HJ_14*0.125,HJ_14*0.1,2,0),COLORFF0000;
IF ((DIFF>=REF(DIFF,1) AND DIFF>=0 ),DIFF,DRAWNULL),COLORRED LINETHICK2;
IF ((DIFF<=REF(DIFF,1) AND DIFF<=0 ),DIFF,DRAWNULL),COLORGREEN LINETHICK2;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
DRAWICON((CROSS(DIFF,DEA) AND CROSS(J,K)),DIFF,34);
DRAWICON((CROSS(DEA,DIFF) AND CROSS(K,J) AND DIFF>0),DIFF,35);