通达信金戈铁马指标公式
通达信九转MACD指标公式
通达信金戈铁马指标公式:
D值:=35;
月金叉:=crOSS(kd.K#MONTH,KD.D#MONTH),COLORLIMAGENTA;
月死叉:=CROSS(KD.D#MONTH,KD.K#MONTH),COLORGREEN;
stICKLINE(月金叉,50,80,1,0),COLORLIMAGENTA;
STICKLINE(月死叉,50,80,1,0),COLORGREEN;
DRAWTEXT(月金叉,75,' 月金'),COLORLIMAGENTA;
DRAWTEXT(月死叉,75,' 月死'),COLORGREEN;
周金叉:=CROSS(KD.K#WEEK,KD.D#WEEK),COLORLIMAGENTA;
周死叉:=CROSS(KD.D#WEEK,KD.K#WEEK),COLORGREEN;
STICKLINE(周金叉,20,50,1,0),COLORLIMAGENTA;
STICKLINE(周死叉,20,50,1,0),COLORGREEN;
DRAWTEXT(周金叉,25,' 周金'),COLORLIMAGENTA;
DRAWTEXT(周死叉,25,' 周死'),COLORGREEN;
NOTEXT高:80,COLORBLUE,LINETHICK3;
NOTEXT中:50,POINTDOT,COLORWHITE;
NOTEXT低:20,COLORBLUE,LINETHICK3;
NOTEXT周:-50,COLORBLUE,LINETHICK3;
{NOTEXT周1:-80,COLORWHITE,LINETHICK3;}
NOTEXT20:IF(KD.K#MONTH>=KD.D#MONTH,NOTEXT低,DRAWNULL),COLORRED,LINETHICK3;
NOTEXT80:IF(KD.K#WEEK>=KD.D#WEEK,NOTEXT高,DRAWNULL),COLORRED,LINETHICK3;
NOTEXT150:IF(macd.DIF#WEEK>MacD.DEA#WEEK,NOTEXT周,DRAWNULL),COLORRED,LINETHICK3;
DRAWTEXT(DAYSTOTODAY=0,80,' 周K'),COLOR00FFFF;
DRAWTEXT(DAYSTOTODAY=0,20,' 月K'),COLOR00FFFF;
DRAWTEXT(DAYSTOTODAY=0,-50,' 周M'),COLOR00FFFF;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,3,1),COLORWHITE,LINETHICK1;
D:SMA(K,3,1),COLORYELLOW,LINETHICK1;
LC := REF(CLOSE,1);
rsi1:=SMA(MAX(CLOSE-LC,0),3,1)/SMA(Abs(CLOSE-LC),3,1)*100;
RSI2:=SMA(MAX(CLOSE-LC,0),5,1)/SMA(ABS(CLOSE-LC),5,1)*100;
RSI3:=SMA(MAX(CLOSE-LC,0),8,1)/SMA(ABS(CLOSE-LC),8,1)*100;
相对强弱:=0.5*RSI1+0.31*RSI2+0.19*RSI3;
WAVE1:=SMA(100*(CLOSE-LLV(LOW,8))/(HHV(HIGH,8)-LLV(LOW,8)),3,1);
WAVE2:=SMA(100*(CLOSE-LLV(LOW,8))/(HHV(HIGH,8)-LLV(LOW,8)),5,1);
WAVE3:=SMA(100*(CLOSE-LLV(LOW,8))/(HHV(HIGH,8)-LLV(LOW,8)),8,1);
短线波段:=0.5*WAVE1+0.31*WAVE2+0.19*WAVE3;
机会区:=20,POINTDOT,COLORRED;
风险区:=80,POINTDOT,COLORGREEN;
风险:=0.5*相对强弱+0.5*短线波段,COLORYELLOW,NODRAW;
CD1:=IF(风险<20 AND CLOSE>OPEN AND ddx>0,1,0);
CD2:=IF(风险<20 AND LOW>=REF(LOW,1) AND CLOSE>LOW AND DDX>0,1,0);
CD3:=IF(REF(风险,1)<20 AND 风险>REF(风险,1),1,0);
LBUY:=(CD1=1 OR CD2=1 OR CD3=1);
X:=(LBUY AND COUNT(LBUY,3)=1);
{DRAWICON(X,50,25);}
{ST:=NOT(NAMELIKE('S') OR NAMELIKE('*S')) AND vol>1;
FJC1:=CROSS(MA(C,5),MA(C,10));
FJC2:=CROSS(MA(C,5),MA(C,20));
FJC3:=CROSS(MA(C,10),MA(C,20));
FJC4:=BArslAST(CROSS(MA(C,5),MA(C,20)));
FJC5:=ATAN((MA(C,60)/REF(MA(C,60),1)-1)*100)*57.3;
FL:=VOL>REF(V,1)*1.5 OR V=HHV(V,8);
FJC6:=ATAN((MA(C,13)/REF(MA(C,13),1)-1)*100)*57.3;
FJC7:=ATAN((MA(C,21)/REF(MA(C,21),1)-1)*100)*57.3;
FJC8:=C>REF(C,1)*1.07 AND FL;
FJC9:=BARSLAST(FJC8);
FJC10:=HHV(C,FJC9)<=REF(H,FJC9) AND LLV(C,FJC9)>REF(L,FJC9);
飞机场:(IF(EXIST(FJC2 AND EXIST(FJC1,3),5),FJC3,0) AND LLV(CLOSE,FJC4)>REF(OPEN,FJC4+1) AND ST)*100,COLORFFFFFF;
超飞机场:(IF(BARSLAST(飞机场)<=55 AND FJC5>0,FL AND FJC3 AND EXIST(CROSS(MACD.DIF,MACD.DEA) AND MACD.DIF>0,2),0) AND ST)*100,COLOR00FFFF;
登高望远:(IF(BARSLAST(飞机场)<=55 AND FJC5>0 AND FJC4>5,CROSS(CLOSE,REF(HHV(H,FJC4),1)) AND VOL=HHV(V,FJC4),0) AND ST)*100,COLOR0000FF;}
{DRAWICON(D<=KD买点 AND CROSS(K,D),D,1);
DRAWICON(CROSS(D,K),K,2);}
DRAWICON(KD.K#MONTH<KD.D#MONTH AND KD.K#WEEK<KD.D#WEEK AND CROSS(D,K) AND K>50,95,12);
DRAWICON( K>=70 AND CROSS(D,K),95,37);
DRAWICON(KD.K#WEEK<KD.D#WEEK AND CROSS(D,K) AND K>=60,95,36);
DRAWICON(CROSS(K,D) AND K<35,35,38);
DRAWICON(KD.K#WEEK>KD.D#WEEK AND CROSS(K,D) AND D<35,35,24);
DRAWICON(KD.K#MONTH>KD.D#MONTH AND KD.K#WEEK>KD.D#WEEK AND CROSS(K,D) AND D<50,35,9);
KD共振1:=周金叉 AND EXIST(CROSS(K,D),3) AND D<=D值;
KD共振2:=EXIST(周金叉,3) AND CROSS(K,D) AND D<=D值;
KDXG:=KD共振1 OR KD共振2;
DRAWICON(KDXG ,60,5);
{MACD}
DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIF,9);
MYY:=EMA(CLOSE,3)-EMA(CLOSE,3);
YMM:=EMA(MYY,3);
MACD:=(DIF-DEA)*2*IF(C<5,400,IF(C<10,200,IF(C<20,100,IF(C<30,60,IF(C<50,50,IF(C<100,30,IF(C<300,15,IF(C<900,5,2))))))))COLORSTICK;
DIFF1:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA1:=EMA(DIFF1,9);
{DIF上升为红色,下降为绿色}
IF(DIF>REF(DIF,1),DIF,DRAWNULL),COLORRED,LINETHICK2,NODRAW;
IF(DIF<REF(DIF,1),DIF,DRAWNULL),COLORGREEN,LINETHICK2,NODRAW;
{加了DEA的上升棕色,下降黄色}
IF(DEA>REF(DEA,1),DEA,DRAWNULL),COLORBROWN,LINETHICK2,NODRAW;
IF(DEA<REF(DEA,1),DEA,DRAWNULL),COLORYELLOW,LINETHICK2,NODRAW;
MACD2:=MACD;
获利比:WINNER(C),NODRAW;
涨家数:=INDEXADV,NODRAW,COLORRED;
跌家数:=INDEXDEC,NODRAW,COLORGREEN;
正量能:=涨家数/(涨家数+跌家数)*100,NODRAW,COLORMAGENTA;
{以下是顶底背离画图}
TR1:=SUM(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),14);
HD:=HIGH-REF(HIGH,1);
LD:=REF(LOW,1)-LOW;
PDM:=SUM(IF(HD>0 AND HD>LD,HD,0),14);
MDM:=SUM(IF(LD>0 AND LD>HD,LD,0),14);
pdi:=PDM*100/TR;
mdi:=MDM*100/TR;
A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
B1:=REF(C,A1+1)>C AND REF(DIF,A1+1)<DIF AND CROSS(DIF,DEA);
A2:=BARSLAST(REF(CROSS("kdj.K"(9,3,3),"KDJ.D"(9,3,3)),1));
B2:=REF(C,A2+1)>C AND REF("KDJ.K"(9,3,3),A2+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));
C1:=BARSLAST(REF(CROSS(DEA,DIF),1));
D1:=REF(C,C1+1)<C AND REF(DIF,C1+1)>DIF AND CROSS(DEA,DIF);
C2:=BARSLAST(REF(CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3)),1));
D2:=REF(C,C2+1)<C AND REF("KDJ.K"(9,3,3),C2+1)>"KDJ.K"(9,3,3) AND CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3));
C3:=BARSLAST(REF(CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)),1));
D3:=REF(C,C3+1)<C AND REF("RSI.RSI1"(6,12,24),C3+1)>"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24));
C4:=BARSLAST(REF(CROSS(MDI,PDI),1));
D4:=REF(C,C+1)<C AND REF(MDI,C4+1)>MDI AND CROSS(MDI,PDI);
A4:=BARSLAST(REF(CROSS(PDI,MDI),1));
B4:=REF(C,A4+1)>C AND REF(PDI,A4+1)<PDI AND CROSS(PDI,MDI);
M底:IF(B1>0,1,0),COLORRED,NODRAW;
K底:IF(B2>0,1,0),COLORFF00FF,NODRAW;
R底:IF(B3>0,1,0),COLORYELLOW,NODRAW;
D底:IF(B4>0,1,0),COLORBROWN,NODRAW;
K顶:IF(D2>0,1,0),COLORFFCC66,NODRAW;
M顶:IF(D1>0,1,0),COLOR00FF00,NODRAW;
R顶:IF(D3>0,1,0),COLORWHITE,NODRAW;
D顶:IF(D4>0,1,0),COLORLIRED,NODRAW;
DRAWLINE(A1=0,DEA,M底,DEA,0),COLORRED,LINETHICK2;
DRAWLINE(A2=0,DEA,M顶,DEA,0),COLOR00FF00,LINETHICK2;
底背离:=M底+K底+R底+D底,NODRAW;
顶背离:=M顶+K顶,NODRAW;
STICKLINE(B1>0,-10,0,2,0),COLORRED;
STICKLINE(B2>0,-10,-20,2,0),COLORFF00FF;
STICKLINE(B3>0,-10,0,2,0),COLORYELLOW;
STICKLINE(B4>0,-10,-20,2,0),COLORBROWN;
STICKLINE(D1>0,10,0,2,0),COLOR00FF00;
STICKLINE(D2>0,10,20,2,0),COLORFFCC66;
STICKLINE(D3>0,10,0,2,0),COLORWHITE;
STICKLINE(D4>0,10,20,2,0),COLORLIRED;
{}
STICKLINE(((MACD2>=0) AND (MACD2 < REF(MACD2,1))),0,IF(MACD2>150,150,MACD2),0,0),COLORMAGENTA;
STICKLINE((MACD2<0),0,IF(MACD2<-150,-150,MACD2),0,0),COLORGREEN;
STICKLINE(((MACD2<0) AND (MACD2 > REF(MACD2,1))),0,IF(MACD2<-150,-150,MACD2),0,1),COLORWHITE;
DRAWICON(LONGCROSS(CLOSE,MA(CLOSE,5),17),MACD2,1);
DRAWICON(LONGCROSS(MA(CLOSE,5),CLOSE,17),MACD2,2);
低位反转:=MACD<0 AND MACD>REF(MACD ,1) AND REF(MACD ,1)<REF(MACD ,2)AND REF(MACD ,2)<REF(MACD ,3)AND REF(MACD ,3)<REF(MACD ,4);
STICKLINE(低位反转,0,MACD,0.3,0),COLORRED;
MACDXG:=低位反转 AND KD.K>=REF(KD.K,1) AND MACD<=-5;
DRAWICON((EXIST(KDXG,3) AND MACDXG) OR (KDXG AND EXIST(MACDXG,3)),95,23) ;
高位反转:=MACD>0 AND MACD<REF(MACD ,1) AND REF(MACD ,1)>REF(MACD ,2)AND REF(MACD ,2)>REF(MACD ,3)AND REF(MACD ,3)>REF(MACD ,4);
STICKLINE(高位反转,0,MACD,0.3,0),COLORGREEN;
低位金叉:=CROSS(DIF,DEA) AND DIF<-0.1;
DRAWICON(低位金叉 ,-15,28);
JCCOUNT:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0));
二次金叉:=(CROSS(DIF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1)*0.3,COLORFFFFFF;
DRAWICON(二次金叉>0,-15,29);
三次金叉:=(CROSS(DIF,DEA) AND DEA<0 AND COUNT(JCCOUNT=3,60)=1)*0.3,COLOR00FFFF;
DRAWICON(三次金叉>0,-15,30);
JCCOUNT1:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA<=0));
零上二金:=(CROSS(DIF,DEA) AND DEA>0 AND COUNT(JCCOUNT1=2,21)=1)*0.3,COLORFFFFFF;
DRAWICON(零上二金>0,-15,30);
零上一金:=(CROSS(DIF,DEA) AND DEA>0 AND COUNT(JCCOUNT1=1,21)=1)*0.3,COLORFFFFFF;
DRAWICON(零上一金,-15,30);{零上一金}
双底:DRAWICON(底背离>1,5,34);
DRAWICON(顶背离>0,5,35);
月RSI1:="RSI.RSI1#MONTH"(9),COLORWHITE;
A:=月RSI1>50;
首月R:CROSS(A>REF(A,1),0.5),COLORWHITE,LINETHICK3;
STICKLINE(首月R,-60,-30,1,0),COLORWHITE,LINETHICK3;
DRAWTEXT(首月R,-50,' 月R'),COLORWHITE;
周RSI1:="RSI.RSI1#WEEK"(9),COLORGREEN;
AAAA:=周RSI1>50;
BBBB:=周RSI1;
首周R:CROSS(AAAA>REF(AAAA,1),0.5),COLORRED,LINETHICK4;
STICKLINE(首周R,-20,-40,1,0),COLORRED,LINETHICK4;
DRAWTEXT(首周R,-40,' 周R'),COLORRED;
首周R1:CROSS(50,BBBB);
STICKLINE(首周R1,-60,-80,1.5,0),COLORGREEN,LINETHICK4;
DRAWTEXT(首周R1,-60,' 周R'),COLORGREEN;
通达信标王抄底选股指标公式