股资源-股票学习站-学炒股-股票课程-炒股教程-分析选股指标-入门基础知识

 找回密码
 注册昵称

QQ登录

只需一步,快速开始

搜索
上一主题 下一主题

[通达信] 把KDJ的MACD做成主图更加方便与分析【主图.附图.源码】加通达信的


    [-----复制链接-----]
楼主
 通达信源码安装路径:1,工具栏点击公式选项。2,弹出公式窗口点击新建。3,把源码复制到指标编辑器保存。4,回到K线图界面安装建立好的公式 || 2023-10-9 11:36:26

以下是把KDJ的MACD做成主图更加方便与分析【主图.附图.源码】加通达信的

根据大家的要求我进一步把原来的幅图改成主图.再一次发给大家.源码不用理想币.但是你还是【不要拿了就走】.与人方便.还是回复一下.让更多的人知道.不更好吗.-------------
【A】大智慧的和通达信的.不是完全一样.这是因为各有特别的函数.不能取代. 也各有所长.
【B】用KDJ的J编辑MACD是有好处.但是你要是用在主图那就不一样了. 这个MACD的数据比原来的MACD大了十倍.百倍.所以和股价极其不协调.为此不得不加参数【PK】然而股价由一两块到几百块.指数则上千上万.所以为了明确看清楚【K线】就必须大幅度调整【PK】这个数据.大家看看我发的图.就明白了.
【C】我仔细研究一下参数【PK】每次换股都得调正太麻烦了---------------改用【PK:=50/C;】也可以的-----------通达信软件同样也可以的-----------------
大智慧的源码如下;-------------------------------------------------------------------

DRAWGBKlast(c>0,strip(R【】GB(0,0,60),RGB(0,0,0),0));
PK:=50/C; {后改的 不用再调正参数了}
A7:=(2*C+H+L)/4;
操作:WMA(a7,5),COLOR0000ff,linethick3;
LLX:LLV(操作,2),COLORFF9900,linethick2; ;
PARTLINE(操作,操作=LLX,rgb(0,200,200),操作<>LLX,rgb(255,0,0)),linethick2;
Var1:LLV(a7,21),color00ffff,LINETHICK1;
Var2:HHV(a7,21),color0044ff,LINETHICK1;
{K线变色}
STICKLINE(CLOSE>=OPEN,OPEN,LOW,0.5,0 ),COLOR0000ff,LAYER0;
STICKLINE(CLOSE>=OPEN,CLOSE,HIGH,0.5,0 ),COLOR0000ff,LAYER0;
STICKLINE(CLOSE<OPEN,OPEN,LOW,0.5,0 ),COLOR00ff00,LAYER7;
STICKLINE(CLOSE<OPEN,CLOSE,HIGH,0.5,0 ),COLOR00ff00,LAYER7;

STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,8,0 ),COLOR002200;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,7,0 ),COLOR004400;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,6,0 ),COLOR006600;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,5,0 ),COLOR008800;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,4,0 ),COLOR00AA00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,3,0 ),COLOR00BB00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,2,0 ),COLOR00CC00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,1,0 ),COLOR00DD00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,0,0 ),COLOR00DD00;

STICKLINE(close>open,close,open,8,0) ,COLORFF00FF;
STICKLINE(close>open,close,open,7,0) ,COLORFF22FF;
STICKLINE(close>open,close,open,6,0) ,COLORFF44FF;
STICKLINE(close>open,close,open,5,0) ,COLORFF66FF;
STICKLINE(close>open,close,open,4,0) ,COLORFF88FF;
STICKLINE(close>open,close,open,3,0) ,COLORFF99FF;
STICKLINE(close>open,close,open,2,0) ,COLORFFAAFF;
STICKLINE(close>open,close,open,1,0) ,COLORFFBBFF;
STICKLINE(close>open,close,open,0,0) ,COLORFFBBFF;

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,LAYER0;;
DEA:EMA(DIFF,5),COLORFF9900,LAYER0;;
MACD:2*(DIFF-DEA), COLORSTICK;
0,COLORff9900,DOTLINE;
FILLRGN(DIFF,DEA,DIFF>DEA,RGB(80,0,80),DIFF<DEA,RGB(0,120,60)),LAYER7;
DRAWTEXTABS(5,10,'■叠加KDJ的坐标参数与股票价格有关需要调整.在不重叠的条件下尽可能的放大K线:【 PK='+PK+'】'),COLOR00FFFF,LINETHICK3,LAYER0;
DRAWTEXTABS(5,30,'■现在KDJ的参数是:N=9,M1=3,M2=3;'),COLOR00FF00,LINETHICK3,LAYER0;
DRAWTEXTABS(5,50,'■【KDJ】的【MACD】的参数是:LONG=8,LONG=16,M=5;'),COLOR0049FF,LINETHICK3,LAYER0;

{高抛低吸}
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;



通达信的源码如下--------------------------------------------【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;







回复

举报

QQ|

GMT+8, 2024-11-18 13:52

快速回复 返回顶部 返回列表