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

 找回密码
 注册昵称

QQ登录

只需一步,快速开始

搜索
上一主题 下一主题

[指标编写] 通达信日周月线共振指标公式源码


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

DRAWGBK(C>0, RGB(1,1,1),RGB(1,1,1),0,'0',0);
DIF:EMA(CLOSE,12) - EMA(CLOSE,26),LINETHICK0;
DEA:EMA(DIF,9),LINETHICK0;
A1:=BARSLAST(REF(crOSS(DIF,DEA),1));
B1:=REF(C,A1+1)>C AND REF(DIF,A1+1)<DIF AND CROSS(DIF,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,DIF),1));
D1:=REF(C,C1+1)<C AND REF(DIF,C1+1)>DIF AND CROSS(DEA,DIF);
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));
STICKLINE(B1>0,130,120,2,0),COLORRED;
DRAWTEXT((B1>0),124.5,' macd底背离'),COLORRED;
STICKLINE(D1>0,130,120,2,0),COLORFF8000;
DRAWTEXT((D1>0),124.5,' MACD顶背离'),COLORFF8000;
STICKLINE(B2>0,0,-10,2,0),COLORFA00FA;
DRAWTEXT((B2>0),-6,' KDJ底背离'),COLORFA00FA;
STICKLINE(D2>0,0,-10,2,0),COLORGREEN;
DRAWTEXT((D2>0),-6,' KDJ顶背离'),COLORGREEN;
STICKLINE(B3>0,-20,-10,2,0),COLORYELLOW;
DRAWTEXT((B3>0),-15,' RSI底背离'),COLORYELLOW;
STICKLINE(D3>0,-20,-10,2,0),COLORCYAN;
DRAWTEXT((D3>0),-15,' RSI顶背离'),COLORCYAN;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,9,3),LINETHICK0;
D:SMA(K,9,3),LINETHICK0;
J:3*K-2*D,LINETHICK0;
{A:=CROSS(DIF,DEA) AND CROSS(K,D) AND CROSS(J,D);
STICKLINE(A,0,100,2,0),COLORYELLOW;
DRAWICON(A,92,25);DRAWICON(A,42,25);}
{DRAWTEXT(A,93,' ★MACD_KDJ金叉'),COLORYELLOW;
DRAWTEXT(A,43,' ★KDJ_MACD金叉'),COLORYELLOW;}
DIF30:=EMA(CLOSE,12/8)-EMA(CLOSE,26/8);
DEA30:=EMA(DIF30,9/4);
STICKLINE(DIF30>=DEA30,100,105,2,0),COLORRED;
STICKLINE(DIF30<DEA30,100,105,2,0),COLOR649600;
DRAWTEXT(ISLASTBAR,102,' 30M'),COLORYELLOW;
DIF60:=EMA(CLOSE,12/4)-EMA(CLOSE,26/4);
DEA60:=EMA(DIF60,9/2);
STICKLINE(DIF60>=DEA60,90,95,2,0),COLORRED;
STICKLINE(DIF60<DEA60,90,95,2,0),COLOR649600;
DRAWTEXT(ISLASTBAR,92,' 60M'),COLORYELLOW;
日DIF:="MACD.DIF#DAY";
日DEA:="MACD.DEA#DAY";
日死叉:STICKLINE(日DIF<日DEA,80,85,2,0),COLOR649600;
日金叉:STICKLINE(日DIF>日DEA,80,85,2,0),COLORRED;
DRAWTEXT(ISLASTBAR,82,' 日M'),COLORYELLOW;
周DIF:="MACD.DIF#WEEK"(12,26,9);
周DEA:="MACD.DEA#WEEK"(12,26,9);
周死叉:STICKLINE(周DIF<周DEA,70,75,2,0),COLOR649600;
周金叉:STICKLINE(周DIF>周DEA,70,75,2,0),COLORRED;
DRAWTEXT(ISLASTBAR,72,' 周M'),COLORYELLOW;
月DIF:="MACD.DIF#MONTH"(12,26,9);
月DEA:="MACD.DEA#MONTH"(12,26,9);
月死叉:STICKLINE(月DIF<月DEA,60,65,2,0),COLOR649600;
月金叉:STICKLINE(月DIF>月DEA,60,65,2,0),COLORRED;
DRAWTEXT(ISLASTBAR,62,' 月M'),COLORYELLOW;
N:=1;
月K:KDJ.K#MONTH,NODRAW,COLORWHITE,LINETHICK0;
月D:KDJ.D#MONTH,NODRAW,COLORYELLOW,LINETHICK0;
月J:KDJ.J#MONTH,NODRAW,COLORMAGENTA,LINETHICK0;
周K:KDJ.K#WEEK,NODRAW,COLORWHITE,LINETHICK0;
周D:KDJ.D#WEEK,NODRAW,COLORYELLOW,LINETHICK0;
周J:KDJ.J#WEEK,NODRAW,COLORMAGENTA,LINETHICK0;
日K:KDJ.K,NODRAW,COLORWHITE,LINETHICK0;
日D:KDJ.D,NODRAW,COLORYELLOW,LINETHICK0;
日J:KDJ.J,NODRAW,COLORMAGENTA,LINETHICK0;
{K日金叉:=CROSS(日K,日D) AND (日D<40 OR 日D>60);
K周金叉:=CROSS(周K,周D) AND (周D<40 OR 周D>60);
K月金叉:=CROSS(月K,月D) AND (月D<40 OR 月D>60);
共振KDJ:=(K周金叉 AND K日金叉) OR (K周金叉 AND K月金叉) OR (K日金叉 AND K月金叉)OR (K日金叉 AND
K周金叉 AND K月金叉);
{STICKLINE(共振KDJ,0,50,2,0),COLORYELLOW;
DRAWICON(共振KDJ,42,25);
{DRAWTEXT((K周金叉 AND K日金叉) OR (K周金叉 AND K月金叉) OR (K日金叉 AND K月金叉)OR (K日金叉 AND
K周金叉 AND K月金叉),42,' ★KDJ(日/周/月)共振'),COLORYELLOW;}
NOTEXT月K:IF(N=3,月K,DRAWNULL),COLORWHITE,LINETHICK0;
NOTEXT月D:IF(N=3,月D,DRAWNULL),COLORYELLOW,LINETHICK0;
NOTEXT月J:IF(N=3,月J,DRAWNULL),COLORMAGENTA,LINETHICK0;
NOTEXT周K:IF(N=2,周K,DRAWNULL),COLORWHITE,LINETHICK0;
NOTEXT周D:IF(N=2,周D,DRAWNULL),COLORYELLOW,LINETHICK0;
NOTEXT周J:IF(N=2,周J,DRAWNULL),COLORMAGENTA,LINETHICK0;
NOTEXT日K:IF(N=1,日K,DRAWNULL),COLORWHITE,LINETHICK0;
NOTEXT日D:IF(N=1,日D,DRAWNULL),COLORYELLOW,LINETHICK0;
NOTEXT日J:IF(N=1,日J,DRAWNULL),COLORMAGENTA,LINETHICK0;
57,COLORYELLOW,LINETHICK2;
RSV30:=(CLOSE-LLV(LOW,18))/(HHV(HIGH,18)-LLV(LOW,18));
K30:=SMA(RSV30,3,1);
D30:=SMA(K30,3,1);
STICKLINE(K30>= D30,50,55,2,0),COLORRED;
STICKLINE(K30 < D30,50,55,2,0),COLORGREEN;
DRAWTEXT(ISLASTBAR,49,' 30K'),COLORWHITE;
RSV60:=(CLOSE-LLV(LOW,36))/(HHV(HIGH,36)-LLV(LOW,36));
K60:=SMA(RSV60,3,1);
D60:=SMA(K60,3,1);
STICKLINE(K60>= D60,40,45,2,0),COLORRED;
STICKLINE(K60 < D60,40,45,2,0),COLORGREEN;
DRAWTEXT(ISLASTBAR,39,' 60K'),COLORWHITE;
STICKLINE(日K>=日D,30,35,2,0),COLORRED;
STICKLINE(日K< 日D,30,35,2,0),COLORGREEN;
DRAWTEXT(ISLASTBAR,29,' 日K'),COLORWHITE;
STICKLINE(周K>=周D,20,25,2,0),COLORRED;
STICKLINE(周K< 周D,20,25,2,0),COLORGREEN;
DRAWTEXT(ISLASTBAR,19,' 周K'),COLORWHITE;
STICKLINE(月K>=月D,10,15,2,0),COLORRED;
STICKLINE(月K< 月D,10,15,2,0),COLORGREEN;
DRAWTEXT(ISLASTBAR,9,' 月K'),COLORWHITE;
{AAAA:=( 日DIF>日DEA AND 周DIF>周DEA AND 月DIF>月DEA AND 日K>=日D AND 周K>=周D AND 月K>=月D);
DRAWICON(AAAA,95,1);
DRAWICON(AAAA,99,1);
DRAWICON(AAAA,103,1);
STICKLINE ( 日DIF>日DEA AND 周DIF>周DEA AND 月DIF>月DEA AND 日K>=日D AND 周K>=周D AND 月K>=月D ,10,85,0,0),COLORMAGENTA;
{0,LINETHICK1,DOTLINE,COLORWHITE;
50,LINETHICK1,COLORWHITE;
100,LINETHICK1,DOTLINE,COLORWHITE;}
{DRAwrECTREL(0,0,180,990,RGB(250,0,250));
DRAWTEXT_FIX(ISLASTBAR,0.111,0.03,0,'KDJ(日/周/月)'),COLOR00FFFF;
DRAWTEXT_FIX(ISLASTBAR,0.101,0.18,0,'日K='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.140,0.18,0,日K),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.101,0.31,0,'日D='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.140,0.31,0,日D),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.101,0.44,0,'周K='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.140,0.44,0,周K),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.101,0.57,0,'周D='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.140,0.57,0,周D),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.101,0.70,0,'月K= '),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.140,0.70,0, 月K),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.101,0.83,0,'月D='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.140,0.83,0,月D),COLORFFFFFF;
DRAWRECTREL(0,0,90,990,RGB(220,0,0));
DRAWTEXT_FIX(ISLASTBAR,0.023,0.03,0,'MACD(日/周/月)'),COLOR00FFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.18,0,'日DIF='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.18,0,日DIF),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.31,0,'日DEA='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.31,0,日DEA),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.44,0,'周DIF='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.44,0,周DIF),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.57,0,'周DEA='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.57,0,周DEA),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.70,0,'月DIF= '),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.70,0, 月DIF),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.83,0,'月DEA='),COLORFFFFFF;
DRAWNUMBER_FIX(ISLASTBAR,0.05,0.83,0,月DEA),COLORFFFFFF;};





回复

举报

QQ|

GMT+8, 2024-11-28 01:31

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