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

 找回密码
 注册昵称

QQ登录

只需一步,快速开始

搜索
上一主题 下一主题

[通达信] 通达信实用macd叠加kdj指标副图贴图说明


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

以下是通达信实用macd叠加kdj指标副图贴图说明

彩带是macd,

红色macd金叉,绿色死叉,

各种金叉和背离信号准确,

macd柱线在0下转红变短买入,0上转蓝变短是卖出,

买入卖出配合其他信号。

{MACD叠加KDJ}

{改编 BY SHUHONG}

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(CLOSE,12)-EMA(CLOSE,26);

DEA:=EMA(DIFF,9);

MACD:=2*(DIFF-DEA);

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;

KX:=250;

KH:=HHV(K,KX);

DH:=HHV(D,KX);

JH:=HHV(J,KX);

KL:=LLV(K,KX);

DL:=LLV(D,KX);

JL:=LLV(J,KX);

HKMAX:=MAX(KH,MAX(DH,JH));

LKMIN:=MIN(KL,MIN(DL,JL));

KHLB:=(HKMAX+LKMIN)/2;

KHLC:=HKMAX-LKMIN;

MHF:=HHV(DIFF,KX);

MHD:=HHV(DEA,KX);

MHM:=HHV(MACD,KX);

MLF:=LLV(DIFF,KX);

MLD:=LLV(DEA,KX);

MLM:=LLV(MACD,KX);

HMAX:=MAX(MHF,MAX(MHD,MHM));

LMIN:=MIN(MLF,MIN(MLD,MLM));

FHLB:=(HMAX-LMIN)/100;

FHLC:=HMAX-LMIN;

SH:=(0-FHLB)*(KHLC/FHLC)+KHLB;

DIFFA:=(DIFF-FHLB)*(KHLC/FHLC)+KHLB;

DEAA:=(DEA-FHLB)*(KHLC/FHLC)+KHLB;

DRAWBAND(DIFFA,RGB(255,64,64),DEAA,RGB(64,255,64));

MACDA:=(MACD-FHLB)*(KHLC/FHLC)+KHLB;

CDA:=MACD<REF(MACD,1) AND MACD>0;

CDB:=MACD>=REF(MACD,1) AND MACD>0;

CDC:=MACD>REF(MACD,1) AND MACD<0;

CDD:=MACD<=REF(MACD,1) AND MACD<0;

STICKLINE(CDA,SH,MACDA,0.1,0),COLORBLUE;{0上蓝柱}

STICKLINE(CDB,SH,MACDA,0.1,0),COLOR8000FF; {0上红柱}

STICKLINE(CDC,SH,MACDA,0.1,0),COLOR8000FF;{0下红柱}

STICKLINE(CDD,SH,MACDA,0.1,0),COLORBLUE;{0下蓝柱}

DRAWTEXT(BARSTATUS=2,SH,' 0轴'),COLORWHITE;

{-------------------------------------------------------------}

{传统KDJ}

KKK:SMA(RSV,3,1),COLORWHITE,LINETHICK2;

DDD:SMA(KKK,3,1),COLORYELLOW,LINETHICK2;

JJJ:3*KKK-2*DDD,COLORMAGENTA,LINETHICK2;

DRAWTEXT(ISLASTBAR,KKK,' ←K'),COLORWHITE;

DRAWTEXT(ISLASTBAR,DDD,' ←D'),COLORYELLOW;

DRAWTEXT(ISLASTBAR,JJJ,' ←J'),COLORMAGENTA;

{MACD KDJ 金叉共振 信号}

A:=CROSS(DIFF,DEA) AND CROSS(KKK,DDD) AND CROSS(JJJ,DDD);

{共振出现时图标}

DRAWICON(A,20,25);

DRAWTEXT(A,20,' MACD&KDJ金叉共振'),COLORYELLOW;

{低位金叉标识}

低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;

DRAWICON(低位金叉,10,41);

DRAWTEXT(低位金叉,10,' MACD低位金叉'),COLORWHITE;

{二次金叉}

JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));

二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;

DRAWICON(二次金叉,0,41);

DRAWTEXT(二次金叉,0,' MACD二次金叉'),COLORYELLOW;

{MACD,KDJ,RSI顶底背离}

{MACD底背}

A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));

B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,DEA);

{MACD顶背}

C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));

D1:=REF(C,C1+1)<C AND REF(DIFF,C1+1)>DIFF AND CROSS(DEA,DIFF);

{MACD底背信号}

DRAWICON((B1>0),-10,41);

DRAWTEXT((B1>0),-10,' MACD底背离'),COLORRED;

{MACD顶背信号}

DRAWICON((D1>0),-10,37);

DRAWTEXT((D1>0),-10,' MACD顶背离'),COLORGREEN;

{KDJ底背}

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));

{KDJ顶背}

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));

{KDJ底背信号}

DRAWICON((B2>0),85,41);

DRAWTEXT((B2>0),85,' KDJ底背离'),COLORWHITE;

{KDJ顶背信号}

DRAWICON((D2>0),85,37);

DRAWTEXT((D2>0),85,' KDJ顶背离'),COLORGREEN;

{RSI底背}

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));

{RSI顶背}

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));

{RSI顶背信号}

DRAWICON((D3>0),-20,37);

DRAWTEXT((D3>0),-20,' RSI顶背离'),COLORGREEN;

{RSI底背信号}

DRAWICON((B3>0),-20,41);

DRAWTEXT((B3>0),-20,' RSI底背离'),COLORRED;

{KDJ日周共振}

N:=1;

日K:=KDJ.K;

日D:=KDJ.D;

日J:=KDJ.J;

周K:=KDJ.K#WEEK,NODRAW;

周D:=KDJ.D#WEEK,NODRAW;

周J:=KDJ.J#WEEK,NODRAW;

日金叉:=CROSS(日K,日D) AND (日D<40 OR 日D>60);

周金叉:=CROSS(周K,周D) AND (周D<40 OR 周D>60);

{}

共振:=(周金叉 AND 日金叉);

DRAWTEXT((周金叉 AND 日金叉),75,' KDJ日周共振'),COLORYELLOW;

DRAWICON((周金叉 AND 日金叉),75,25);







回复

举报

QQ|

GMT+8, 2024-11-20 04:23

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