N1:=6;N2:=12;N3:=24;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,3,1),LINETHICK2,colorwhite;
D:Sma(K,3,1),LINETHICK2,coloryellow;
J:3*K-2*D,LINETHICK2,colorred;
difF:ema(CLOSE,12)-EMA(CLOSE,26),LINETHICK2,colorgreen;
DEA :EMA(DIFF,9),LINETHICK2,colorblue;
macd:2*(DIFF-DEA),LINETHICK2,colorred;
RSV1:=(HHV(H,9.8)-C)/(HHV(H,9.8)-LLV(L,9.8))*101;
KK:=SMA(RSV1,3,1);
DD:=SMA(KK,3,1);
JJ:=3*KK-2*DD;
买卖:=IF(JJ>=100,100,IF(JJ<=0,0,JJ));
明天买:IF(买卖=100,0-10,0),COLOR00CCCC;
明天卖:IF(买卖=0,90,100),COLOR00FF00;
TYP:=(HIGH+LOW+CLOSE)/3;
stICKLINE(DIFF>REF(DIFF,1),20,20,2,0),colorred;
STICKLINE(DIFF<REF(DIFF,1),20,20,2,0),colorgreen;
STICKLINE(K>=REF(K,1) OR K>D AND DIFF>REF(DIFF,1),80,80,2,1),colorred;
STICKLINE(K<REF(K,1),80,80,2,1),colorgreen;
MacD金叉:=crOSS(MACD,DIFF) AND MACD>=(0-0.05) AND MACD<=0.02;
DRAWTEXT(MACD金叉,40,'▲MACD金叉'),colorred;
XX:=EMA(MA(LOW,3)*0.96,30);
DIFF金叉:=IF(CROSS(DIFF,DEA) AND XX-REF(XX,1)>0 AND MACD>=REF(MACD,1) AND DIFF<=0,1,0);
DRAWTEXT(DIFF金叉=1,35,'▲DIFF金叉'),colorred;
低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;
DRAWTEXT(低位金叉,25,'▲低位金叉'),colorred;
DIFDEA:=COUNT(CROSS(DIFF,DEA),BArslAST(DEA>=0));
二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(DIFDEA=2,21)=1;
DRAWTEXT(二次金叉,20,'▲二次金叉'),colorred;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
MACD底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
DRAWTEXT(MACD底背离,30,'▲MACD底背离'),colorred;
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
MACD顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
DRAWTEXT(FILTER(MACD顶背离,5),100,'?MACD顶背离') ;
周DIFF:='MACD.DIFF#WEEK';
周DEA:='MACD.DEA#WEEK';
周MACD:='MACD.MACD#WEEK';
DIF周金叉:=CROSS(周DIFF,周DEA);
DRAWTEXT(DIF周金叉,45,'▲DIFF周金叉'),colorred;
DRAWTEXT(CROSS(周DEA,周DIFF),110,'?DIFF周死叉') ;
MACD周金叉:=CROSS(周MACD,周DIFF) AND 周MACD>=(0-0.05) AND 周MACD<=0.02;
DRAWTEXT(MACD周金叉,50,'▲MACD周金叉'),colorred;
月DIFF:='MACD.DIFF#MONTH';
月DEA:='MACD.DEA#MONTH';
月MACD:='MACD.MACD#MONTH';
DIF月金叉:=CROSS(月DIFF,月DEA);
DRAWTEXT(DIF月金叉,55,'▲DIFF月金叉'),colorred ;
DRAWTEXT(CROSS(月DEA,月DIFF),105,'?DIFF月死叉') ;
MACD月金叉:=CROSS(月MACD,月DIFF) AND 月MACD>=(0-0.05) AND 月MACD<=0.02;
DRAWTEXT(MACD月金叉,60,'▲MACD月金叉'),colorred;
DIF:(EMA(CLOSE,6)-EMA(CLOSE,13))*100;
DEA:EMA(DIF,5);
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));
DRAWLINE(A2=0,DEA,顶背离,DEA,0),colorbrown,LINETHICK2;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,9,3),colormagenta;
D:SMA(K,9,3),colorblue;
J:3*K-2*D,colorgray;
IF(J<D,J,DRAWNULL),COLORFFEE44;
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底背'),coloryellow;
DJ:=CROSS(J,D) AND D<20;
DRAWTEXT(DJ,J-0.3,'低金叉'),colormagenta;
MDJ:=CROSS(DIF,DEA) AND DEA<0;
DRAWTEXT(MDJ,DEA-0.3,'低金叉'),colorred;
DRAWTEXT(CROSS(DEA,DIF),DIF+0.3,'死叉'),colorcyan;
DRAWTEXT(CROSS(D,J),J+0.3,'死叉'),colorgreen;
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;
AA:=(C-LLV(C,10))/(HHV(C,10)-LLV(C,10));
(CROSS(AA,0.05)-1);
N1:=6;N2:=12;N3:=24;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,3,1),LINETHICK2,colorwhite;
D:Sma(K,3,1),LINETHICK2,coloryellow;
J:3*K-2*D,LINETHICK2,colorred;
difF:ema(CLOSE,12)-EMA(CLOSE,26),LINETHICK2,colorgreen;
DEA :EMA(DIFF,9),LINETHICK2,colorblue;
macd:2*(DIFF-DEA),LINETHICK2,colorred;
RSV1:=(HHV(H,9.8)-C)/(HHV(H,9.8)-LLV(L,9.8))*101;
KK:=SMA(RSV1,3,1);
DD:=SMA(KK,3,1);
JJ:=3*KK-2*DD;
买卖:=IF(JJ>=100,100,IF(JJ<=0,0,JJ));
明天买:IF(买卖=100,0-10,0),COLOR00CCCC;
明天卖:IF(买卖=0,90,100),COLOR00FF00;
TYP:=(HIGH+LOW+CLOSE)/3;
stICKLINE(DIFF>REF(DIFF,1),20,20,2,0),colorred;
STICKLINE(DIFF<REF(DIFF,1),20,20,2,0),colorgreen;
STICKLINE(K>=REF(K,1) OR K>D AND DIFF>REF(DIFF,1),80,80,2,1),colorred;
STICKLINE(K<REF(K,1),80,80,2,1),colorgreen;
MacD金叉:=crOSS(MACD,DIFF) AND MACD>=(0-0.05) AND MACD<=0.02;
DRAWTEXT(MACD金叉,40,'▲MACD金叉'),colorred;
XX:=EMA(MA(LOW,3)*0.96,30);
DIFF金叉:=IF(CROSS(DIFF,DEA) AND XX-REF(XX,1)>0 AND MACD>=REF(MACD,1) AND DIFF<=0,1,0);
DRAWTEXT(DIFF金叉=1,35,'▲DIFF金叉'),colorred;
低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;
DRAWTEXT(低位金叉,25,'▲低位金叉'),colorred;
DIFDEA:=COUNT(CROSS(DIFF,DEA),BArslAST(DEA>=0));
二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(DIFDEA=2,21)=1;
DRAWTEXT(二次金叉,20,'▲二次金叉'),colorred;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
MACD底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
DRAWTEXT(MACD底背离,30,'▲MACD底背离'),colorred;
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
MACD顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
DRAWTEXT(FILTER(MACD顶背离,5),100,'?MACD顶背离') ;
周DIFF:='MACD.DIFF#WEEK';
周DEA:='MACD.DEA#WEEK';
周MACD:='MACD.MACD#WEEK';
DIF周金叉:=CROSS(周DIFF,周DEA);
DRAWTEXT(DIF周金叉,45,'▲DIFF周金叉'),colorred;
DRAWTEXT(CROSS(周DEA,周DIFF),110,'?DIFF周死叉') ;
MACD周金叉:=CROSS(周MACD,周DIFF) AND 周MACD>=(0-0.05) AND 周MACD<=0.02;
DRAWTEXT(MACD周金叉,50,'▲MACD周金叉'),colorred;
月DIFF:='MACD.DIFF#MONTH';
月DEA:='MACD.DEA#MONTH';
月MACD:='MACD.MACD#MONTH';
DIF月金叉:=CROSS(月DIFF,月DEA);
DRAWTEXT(DIF月金叉,55,'▲DIFF月金叉'),colorred ;
DRAWTEXT(CROSS(月DEA,月DIFF),105,'?DIFF月死叉') ;
MACD月金叉:=CROSS(月MACD,月DIFF) AND 月MACD>=(0-0.05) AND 月MACD<=0.02;
DRAWTEXT(MACD月金叉,60,'▲MACD月金叉'),colorred;
DIF:(EMA(CLOSE,6)-EMA(CLOSE,13))*100;
DEA:EMA(DIF,5);
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));
DRAWLINE(A2=0,DEA,顶背离,DEA,0),colorbrown,LINETHICK2;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,9,3),colormagenta;
D:SMA(K,9,3),colorblue;
J:3*K-2*D,colorgray;
IF(J<D,J,DRAWNULL),COLORFFEE44;
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底背'),coloryellow;
DJ:=CROSS(J,D) AND D<20;
DRAWTEXT(DJ,J-0.3,'低金叉'),colormagenta;
MDJ:=CROSS(DIF,DEA) AND DEA<0;
DRAWTEXT(MDJ,DEA-0.3,'低金叉'),colorred;
DRAWTEXT(CROSS(DEA,DIF),DIF+0.3,'死叉'),colorcyan;
DRAWTEXT(CROSS(D,J),J+0.3,'死叉'),colorgreen;
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;
AA:=(C-LLV(C,10))/(HHV(C,10)-LLV(C,10));
(CROSS(AA,0.05)-1);