通达信把KDJ的MACD做成主图更加方便与分析 源码
通达信的源码如下
【PK】参数 0,50000,5.填入表格里-咱们也可以不用这个参数了
DRAWGBK(O C,RGB(0,30,0),RGB(0,0,60),0,'01',0);
PK:=50/C; {后改的 不用再调正参数了}
ZK1:(XMA(XMA(H,25),25)-XMA(XMA(L,25),25))*1+XMA(XMA(H,25),25),DOTLINE,COLORWHITE;
ZD1:XMA(XMA(L,25),25)-(XMA(XMA(H,25),25)-XMA(XMA(L,25),25))*1,DOTLINE,COLORWHITE;
BS:(XMA(XMA(H,60),60)-XMA(XMA(L,60),60))*2.2+XMA(XMA(H,60),60),DOTLINE,COLORRED;
BD:XMA(XMA(L,60),60)-(XMA(XMA(H,60),60)-XMA(XMA(L,60),60))*2.8,DOTLINE,COLORGREEN;
DRAWTEXT(ISLASTBAR,ZK1,STRCAT(' 【卖出】= ',CON2STR(ZK1,2))),COLOR00FFFF;
DRAWTEXT(ISLASTBAR,ZD1,STRCAT(' 【买入】= ',CON2STR(ZD1,2))),COLORWHITE;
DRAWTEXT(ISLASTBAR,BS,STRCAT(' 【顶部】= ',CON2STR(BS,2))),COLOR0044FF;
DRAWTEXT(ISLASTBAR,BD,STRCAT(' 【底部】= ',CON2STR(BD,2))),COLOR00FF00;
DRAWBAND(BS,RGB(0,0,200),ZK1,RGB(0,0,255));
DRAWBAND(ZK1,RGB(80,50,0),ZD1,RGB(80,50,0));
DRAWBAND(ZD1,RGB(15,25,15),BD,RGB(25,45,25));
(XMA(XMA(H,25),25)-XMA(XMA(L,25),25))*1+XMA(XMA(H,25),25),DOTLINE,COLORWHITE;
XMA(XMA(L,25),25)-(XMA(XMA(H,25),25)-XMA(XMA(L,25),25))*1,DOTLINE,COLORWHITE;
(XMA(XMA(H,60),60)-XMA(XMA(L,60),60))*2.2+XMA(XMA(H,60),60),DOTLINE,COLORRED;
XMA(XMA(L,60),60)-(XMA(XMA(H,60),60)-XMA(XMA(L,60),60))*2.8,DOTLINE,COLORGREEN;
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;
DIFF:(EMA(J,8) - EMA(J,16))/PK,COLOR00FF00;
DEA:EMA(DIFF,5),COLORFF9900;
MACD:2*(DIFF-DEA),COLORSTICK;
0,COLORFF9900,DOTLINE;
DRAWBAND(DIFF,RGB(255,80,0),DEA,RGB(0,255,100));
DRAWTEXT_FIX(1,0.02,0.02,0, STRCAT('■叠加KDJ的坐标参数与股票价格有关需要调整【PK】.在不重叠的条件下尽可能的放大K线:▄▄▄▄PK=',CON2STR(PK,2))),COLOR00FFFF;
DRAWTEXT_FIX(1,0.02,0.05,0,'■现在KDJ的参数是:N=9,M1=3,M2=3;'),COLOR00FF00;
DRAWTEXT_FIX(1,0.02,0.08,0,'■【KDJ】的【MACD】的参数是:LONG=8,LONG=16,M=5;'),COLOR0044FF;
{高抛低吸}
MA5:=MA(CLOSE,5);
DIFFG:=(EMA(C,12) - EMA(C,26));
DEAG:=EMA(DIFFG,9);
MACDG:=2*(DIFFG-DEAG);
卖:=CROSS((MA5 REF(MA5,1) AND MACDG REF(MACDG,1) AND J REF(J,1)),(MA5 REF(MA5,1) AND MACDG REF(MACDG,1) AND J REF(J,1)));
DRAWTEXT(FILTER(卖,5),H*1.112,'★卖'),COLOR00FF00;
STICKLINE(FILTER(卖,5),H*1.15,H,0,0),COLOR05FF00;
买:=CROSS((MA5 REF(MA5,1) AND MACDG REF(MACDG,1) AND J REF(J,1)),(MA5 REF(MA5,1) AND MACDG REF(MACDG,1) AND J REF(J,1)));
DRAWTEXT(FILTER(买,5),L*0.83,'★买'),COLOR0000FF;
STICKLINE(FILTER(买,5),L*0.8,L,0,0),COLOR0555FF;
YTSL:=(3*CLOSE+LOW+OPEN+HIGH)/6;
辰星线:(20*YTSL+19*REF(YTSL,1)+18*REF(YTSL,2)+17*REF(YTSL,3)+16*REF(YTSL,4)+15*REF(YTSL,5)+14*REF(YTSL,6)+13*REF(YTSL,7)+12*REF(YTSL,8)+11*REF(YTSL,9)+10*REF(YTSL,10)+9*REF(YTSL,11)+8*REF(YTSL,12)+7*REF(YTSL,13)+6*REF(YTSL,14)+5*REF(YTSL,15)+4*REF(YTSL,16)+3*REF(YTSL,17)+2*REF(YTSL,18)+REF(YTSL,20))/211,COLOR00FFFF;
IF(辰星线 REF(辰星线,1),辰星线,DRAWNULL),LINETHICK3,COLOR0000FF;
IF(辰星线 REF(辰星线,1),辰星线,DRAWNULL),LINETHICK3,COLORFF9900;
{K线}
STICKLINE(CLOSE = REF(CLOSE,1) ,HIGH,LOW,0,1 ),COLORRED;
STICKLINE(CLOSE = REF(CLOSE,1) ,OPEN,CLOSE,3,0 ),COLOR000066;
STICKLINE(CLOSE = REF(CLOSE,1) ,OPEN,CLOSE,2.6,0 ),COLOR000099;
STICKLINE(CLOSE = REF(CLOSE,1) ,OPEN,CLOSE,1.8,0 ),COLOR0000CC;
STICKLINE(CLOSE = REF(CLOSE,1) ,OPEN,CLOSE,1.0,0 ),COLOR0000FF;
STICKLINE(CLOSE = REF(CLOSE,1) ,OPEN,CLOSE,0.4,0 ),COLORCC66FF;
STICKLINE(CLOSE REF(CLOSE,1) ,HIGH,LOW,0,1 ),COLORCYAN;
STICKLINE(CLOSE REF(CLOSE,1) ,OPEN,CLOSE,3,0 ),COLORCC0000;
STICKLINE(CLOSE REF(CLOSE,1) ,OPEN,CLOSE,2.5,0 ),COLORFF1100;
STICKLINE(CLOSE REF(CLOSE,1) ,OPEN,CLOSE,2,0 ),COLORFF2200;
STICKLINE(CLOSE REF(CLOSE,1) ,OPEN,CLOSE,1.6,0 ),COLORFF4400;
STICKLINE(CLOSE REF(CLOSE,1) ,OPEN,CLOSE,1.2,0 ),COLORFF6600;
STICKLINE(CLOSE REF(CLOSE,1) ,OPEN,CLOSE,0.6,0 ),COLORFF8800;
STICKLINE(CLOSE REF(CLOSE,1) ,OPEN,CLOSE,0.2,0 ),COLORCYAN;