MACD指标模板副图指标 通达信 贴图

[复制链接]
查看36 | 回复0 | 2022-7-11 10:38:51 | 显示全部楼层 |阅读模式
附件包含2个副图指标,今天下午进行优化。


金叉共振副图源码:
DIF:(EMA(CLOSE,12)-EMA(CLOSE,26))*100;
DEA:EMA(DIF,9);
MACD:(DIF-DEA)*2,COLORSTICK;
DRAWICON(CROSS(DIF,DEA),DEA,25);
DRAWICON(CROSS(DEA,DIF),DEA,21);
IF(DIF<DEA,DIF,DRAWNULL),COLORGREEN;
DD:=C=HHV(C,180);
EE:=DEA< REF(DEA,1) AND REF(DEA< REF(DEA,1),1)=1;
CC:=C> REF(C,1) AND REF(C> REF(C,1),1)=1;
顶背离:=(DD AND EE AND DEA< HHV(DEA,180))*DEA;
A2:=BARSLAST(REF(CROSS(DEA,DIF),1));
{顶背:=REF(CLOSE,A2+1)<CLOSE AND REF(DIF,A2+1)>DIF AND CROSS(DEA,DIF);}
DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK2;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,9,3),COLORYELLOW;
D:SMA(K,9,3),COLORWHITE;
J:3*K-2*D,COLORMAGENTA;
IF(J<D,J,DRAWNULL),COLORGREEN;
0,COLORWHITE,LINETHICK2;
20,COLORRED;
{50,COLORWHITE;}
80,COLORYELLOW;
100,COLORGREEN,LINETHICK2;
DRAWTEXT(ISLASTBAR,0,'0'),COLORWHITE;
DRAWTEXT(ISLASTBAR,20,'20'),COLORRED;
DRAWTEXT(ISLASTBAR,80,'80'),COLORYELLOW;
DRAWTEXT(ISLASTBAR,100,'100'),COLORGREEN;
A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
B1:=REF(C,A1+1)>C AND REF(DIF,A1+1)<DIF AND CROSS(DIF,DEA);
A22:=BARSLAST(REF(CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)),1));
B2:=REF(C,A22+1)>C AND REF("KDJ.K"(9,3,3),A22+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));
{DRAWTEXT(B1,DEA-0.20,'▲MACD底背'),COLORWHITE;
DRAWTEXT(B2,D-0.20,'●KDJ底背'),COLORWHITE;}
DJ:=CROSS(J,D) AND D<20;
DRAWTEXT(DJ,J-0.3,'低金叉'),COLORCYAN;
MDJ:=CROSS(DIF,DEA) AND DEA<0;
DRAWTEXT(MDJ,DEA-0.3,'低金叉'),COLORCYAN;
{DRAWTEXT(CROSS(DEA,DIF),DIF+0.3,'死叉'),COLORGREEN;
DRAWTEXT(CROSS(D,J),J+0.3,'死叉'),COLORGREEN; }
A:=CROSS(DIF,DEA) AND CROSS(K,D) AND CROSS(J,D);
DRAWICON(A,-25,7);
B4:CROSS(DIF,DEA) AND CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3));
DRAWTEXT(B4,-30,'★金叉共振'),COLORYELLOW;
DRAWICON(CROSS(K,D),D,30);
DRAWICON(CROSS(D,K),D,28);
BA:=DEA>REF(DEA,1);
BB:=SUM(BA,5)>=4;
BC:=C<O;
BD:=SUM(BC,5)>=2;
BXG:FILTER(BB AND BD AND J>REF(J,1) AND REF(J,1)<REF(J,2),3);
STICKLINE(BXG,HHV(J,60),HHV(J,60)-20,1,0),COLORRED;
SS:=EMA(C,11);
LL:=(EMA(C,1)+EMA(C,2)+EMA(C,3)+EMA(C,5))/4;
{短:EMA(LL,2),COLORGREEN,LINETHICK2;}
{长:EMA(SS,2),COLORMAGENTA,LINETHICK2;}
AA:=(C-LLV(C,10))/(HHV(C,10)-LLV(C,10));
(CROSS(AA,0.05)-1);



MACD顶底背离副图源码:
DIFF1:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA1:=EMA(DIFF1,9);
DRAWBAND(DEA1,DRAWNULL,DIFF1,RGB(250,0,0));
DIFF:EMA(CLOSE,12)-EMA(CLOSE,26),COLORYELLOW;
DEA:EMA(DIFF,9),COLORCYAN;
MACD:2*(DIFF-DEA),COLORSTICK;
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(DIFF,DEA),1));
B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,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,DIFF),1));
D1:=REF(C,C1+1)<C AND REF(DIFF,C1+1)>DIFF AND CROSS(DEA,DIFF);
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);
MACD底背A底:IF(B1>0,1,0),COLORRED,NODRAW;
KDJ底背B底:IF(B2>0,1,0),COLORFF00FF,NODRAW;
RSI底背C底:IF(B3>0,1,0),COLORYELLOW,NODRAW;
DMI底背D底:IF(B4>0,1,0),COLORBROWN,NODRAW;
MACD顶背A顶:IF(D1>0,1,0),COLOR00FF00,NODRAW;
KDJ顶背B顶:IF(D2>0,1,0),COLORFFCC66,NODRAW;
RSI顶背C顶:IF(D3>0,1,0),COLORWHITE,NODRAW;
DMI顶背D顶:IF(D4>0,1,0),COLORLIRED,NODRAW;
{以下两行是MACD顶底不能自动画线,有未来函数,放在大括号里,表示没有运行。如果需要运行,请把本行和大括号删除
DRAWLINE(A1=0,DEA,MACD底背,DEA,0),COLORRED,LINETHICK2;
DRAWLINE(A2=0,DEA,MACD顶背,DEA,0),COLOR00FF00,LINETHICK2;}
STICKLINE(B1>0,-0.1,0,2,0),COLORRED;
DRAWTEXT(B1>0,-0.2,'A底'),COLORGREEN;
STICKLINE(B2>0,-0.1,-0.2,2,0),COLORFF00FF;
DRAWTEXT(B2>0,-0.2,'B底'),COLORGREEN;
STICKLINE(B3>0,-0.1,0,2,0),COLORYELLOW;
DRAWTEXT(B3>0,-0.2,'C底'),COLORGREEN;
STICKLINE(B4>0,-0.1,-0.2,2,0),COLORBROWN;
DRAWTEXT(B4>0,-0.2,'D底'),COLORGREEN;
STICKLINE(D1>0,0.1,0,2,0),COLOR00FF00;
DRAWTEXT(D1>0,0.2,'A顶'),COLORRED;
STICKLINE(D2>0,0.1,0.2,2,0),COLORFFCC66;
DRAWTEXT(D2>0,0.2,'B顶'),COLORRED;
STICKLINE(D3>0,0.1,0,2,0),COLORWHITE;
DRAWTEXT(D3>0,0.2,'C顶'),COLORRED;
STICKLINE(D4>0,0.1,0.2,2,0),COLORLIRED;
DRAWTEXT(D4>0,0.2,'D顶'),COLORRED;



2019331061215135.png

2019331061215135.png

2019331074153182.rar

6.38 KB, 下载次数: 0

售价: 1 金钱  [记录]  [购买]

2019331074153182.rar

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则