通达信KDJ布林带源码副图

T:=1;
 SS1:=9;
 SS2:=46;
 SS3:=34;
 SS4:=89;
 BB:=IF(T=1,SS1,IF(T=2,SS2,IF(T=3,SS3,IF(T=4,SS4,0))));
 HP:=HHV(H,BB);
 LP:=LLV(L,BB);
 R:=(C-LP)/(HP-LP)*100;
 MID1:=EMA(R,5);
 TMP1:=STD(MID1,6);
 TOP1:=MID1+2*TMP1;
 BOTTOM1:=MID1-2*TMP1;
 MID2:=EMA(R,12);
 TMP2:=STD(MID2,12);
高:MID2+2*TMP2;
低:MID2-2*TMP2;
中:=(高+低)/2;
 DRAWBAND(高,RGB(255,166,166),中,RGB(255,166,166));{(236,233,216)(172,168,153)}
 {DRAWBAND(上轨,RGB(194,202,255),中轨,RGB(194,202,255));}
 DRAWBAND(低,RGB(194,202,255),中,RGB(194,202,255));{0,128,128(180,188,236)}
 K:SMA(R,2,1),COLORYELLOW,LINETHICK2;
 D:SMA(K,2,1),COLORWHITE,LINETHICK2;
 J:3*K-2*D,COLORLIBLUE,LINETHICK3;
 DRAWBAND(K,RGB(255,0,0),D,RGB(0,255,0));
 DRAWICON(CROSS(J,低) OR CROSS(K,D) AND K<中,低*0.99,1);
 DRAWICON(CROSS(高,J) OR CROSS(D,K),高*1.01,2);
 DRAWTEXT_FIX(1,0.0,0.0,0,'【T=1,短线用T=2,牛市用T=3,中线用T=4,熊市用】'),COLORYELLOW;