给KDJ、MACD金叉共振加个风险区
DIF EMA(CLOSE,12)-EMA(CLOSE,26))*100;DEA:EMA(DIF,9);MACD DIF-DEA)*2,COLORSTICK;DRAWICON(CROSS(DIF,DEA),DEA,1);DRAWICON(CROSS(DEA,DIF),DEA,2);IF(DIF<DEA,DIF,DRAWNULL),COLORGREEN;DD:=C=HHV(C,180);EE:=DEA< REF(DEA,1) AND REF(DEA< REF(DEA,1),1)=1;CC:=C> REF(C,1) AND REF(C> REF(C,1),1)=1;顶背离:=(DD AND EE AND DEA< HHV(DEA,180))*DEA;A2:=BARSLAST(REF(CROSS(DEA,DIF),1));{顶背:=REF(CLOSE,A2+1)<CLOSE AND REF(DIF,A2+1)>DIF AND CROSS(DEA,DIF);}DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORRED,LINETHICK2;RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;K:SMA(RSV,9,3),COLORYELLOW;D:SMA(K,9,3),COLORWHITE;J:3*K-2*D,COLORMAGENTA;IF(J<D,J,DRAWNULL),COLORFFEE44;0,COLORRED,LINETHICK2;20,COLORLIMAGENTA;{50,COLORWHITE;}80,COLORBLUE;100,COLORGREEN,LINETHICK2;DRAWTEXT(ISLASTBAR,0,'高安全区'),COLORRED;DRAWTEXT(ISLASTBAR,20,'安 全 区'),COLORLIMAGENTA;DRAWTEXT(ISLASTBAR,80,'风 险 区'),COLORBLUE;DRAWTEXT(ISLASTBAR,100,'高风险区'),COLORGREEN;A1:=BARSLAST(REF(CROSS(DIF,DEA),1));B1:=REF(C,A1+1)>C AND REF(DIF,A1+1)<DIF AND CROSS(DIF,DEA);A22:=BARSLAST(REF(CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)),1));B2:=REF(C,A22+1)>C AND REF("KDJ.K"(9,3,3),A22+1)<"KDJ.K"(9,3,3) AND CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3));A3:=BARSLAST(REF(CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24)),1));B3:=REF(C,A3+1)>C AND REF("RSI.RSI1"(6,12,24),A3+1)<"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24));DRAWTEXT(B1,DEA-0.20,'▲MACD底背'),COLORWHITE;DRAWTEXT(B2,D-0.20,'●KDJ底背'),COLORFF00FF;{DJ:=CROSS(J,D) AND D<20;DRAWTEXT(DJ,J-0.3,'低金叉'),COLORCYAN;MDJ:=CROSS(DIF,DEA) AND DEA<0;DRAWTEXT(MDJ,DEA-0.3,'低金叉'),COLORGREEN;DRAWTEXT(CROSS(DEA,DIF),DIF+0.3,'死叉'),COLORYELLOW;DRAWTEXT(CROSS(D,J),J+0.3,'死叉'),COLORRED;}A:=CROSS(DIF,DEA) AND CROSS(K,D) AND CROSS(J,D);DRAWICON(A,LOW*0.98,1);B4:CROSS(DIF,DEA) AND CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3));DRAWTEXT(B4,L-0.20,'★金叉共振'),COLOR0099FF;DRAWICON(CROSS(K,D),D,1);DRAWICON(CROSS(D,K),D,2);BA:=DEA>REF(DEA,1);BB:=SUM(BA,5)>=4;BC:=C<O;BD:=SUM(BC,5)>=2;BXG:FILTER(BB AND BD AND J>REF(J,1) AND REF(J,1)<REF(J,2),3);STICKLINE(BXG,HHV(J,60),HHV(J,60)-20,1,0),COLORRED;SS:=EMA(C,11);LL:=(EMA(C,1)+EMA(C,2)+EMA(C,3)+EMA(C,5))/4;{短:EMA(LL,2),COLORGREEN,LINETHICK2;}{长:EMA(SS,2),COLORMAGENTA,LINETHICK2;}AA:=(C-LLV(C,10))/(HHV(C,10)-LLV(C,10));
(CROSS(AA,0.05)-1);
(CROSS(AA,0.05)-1);