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

 找回密码
 注册昵称

QQ登录

只需一步,快速开始

搜索
上一主题 下一主题

[通达信] 通达信自用强势MACD副图公式 源码


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

以下是通达信自用强势MACD副图公式 源码

通达信自用强势MACD副图公式 源码

DIF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIF,9);
{此段为DIF线变色}
IF(DIF,DIF,DRAWNULL),COLORWHITE;
IF(DIF>REF(DIF,1),DIF,DRAWNULL),COLORRED;
IF(DIF<REF(DIF,1),DIF,DRAWNULL),COLORGREEN;
DEA1:DIF,COLORWHITE,CROSSDOT;
MACD:"MACD.MACD",NODRAW;
W1:STICKLINE(MACD>0,MACD,0,0,1),COLORRED;
W2:STICKLINE(MACD<0,MACD,0,0,1),COLORGREEN;
VA1:=HHVBARS(MACD,BARSLAST(MACD<0)+1);
VA2:=CROSS(BACKSET(CROSS(0,MACD),REF(VA1,1)+2),0.5);
QG:=CROSS(BACKSET(CROSS(0,MACD) OR (ISLASTBAR AND MACD>0),REF(VA1,1)+2),0.5);
前高:DRAWLINE(VA2,MACD,REF(VA2,1),REF(MACD,1),1),COLORMAGENTA;
VA3:=LLVBARS(MACD,BARSLAST(MACD>0)+1);
VA4:=CROSS(BACKSET(CROSS(MACD,0),REF(VA3,1)+2),0.5);
BD:=BARSLAST(FILTERX(CROSS(0,MACD),BARSCOUNT(C)));
前低:DRAWLINE(VA4,MACD,REF(VA4,1),REF(MACD,1),1);
BDTJ:=IF(MACD<0,FILTERX(MACD=LLV(MACD,BARSLAST(MACD>0)),
BARSCOUNT(C)),DRAWNULL);
TSBDTJ:=BARSLAST(BDTJ);
BDZH:=FILTERX(MACD<CONST(LLV(MACD,BD+1)),BARSCOUNT(C));
BDTS:=BARSLAST(BDZH);
本低:IF(BD+1>=1,CONST(LLV(MACD,BD+1)),DRAWNULL);
BDCL:=CROSS(COUNT(CROSS(MACD>本低/2 AND MACD<0,0.5),TSBDTJ)=1,0.5) AND TSBDTJ>=0;
终点:=IF(ISLASTBAR AND MACD>0 AND MACD=HHV(MACD,BARSLAST(MACD<0)),1,
IF(FILTERX(QG,BARSCOUNT(C)),2,DRAWNULL));
UU:=(终点=1 OR 终点=2) AND MACD>0;
ZZ:=FILTERX(UU,BARSCOUNT(C));
本高:DRAWLINE(ZZ,MACD,REF(ZZ,1),REF(MACD,1),1),COLORWHITE;
横线:=CONST(REF(MACD,BARSLAST(ZZ)));
WW:=MACD>横线;
起始点:=FILTERX(REFX(BARSLAST(WW),1)=1,BARSCOUNT(C));
天数:BARSLAST(起始点),COLORYELLOW,NODRAW;
上横线:=DRAWLINE(起始点,横线,ZZ,横线,0),COLORGREEN,DOTLINE;
下横线:=DRAWLINE(BDZH,CONST(LLV(MACD,BD+1)),BDTJ=1,MACD,0),COLOR8080FF,DOTLINE;
DRAWNUMBER(BDTJ,CONST(LLV(MACD,BD+1))*0.9,BDTS);
DRAWNUMBER(ZZ,上横线*1.1,天数);
TJ:=IF(起始点,BARSNEXT(ZZ),DRAWNULL);
红柱数量:IF(天数>0 AND 天数<=REF(TJ,天数),SUM(MACD>0,天数),DRAWNULL),COLORWHITE,NODRAW;
横线起始价:REF(C,天数),NODRAW;
空间评估:(横线起始价-C)/C*100,NODRAW;
TT:=BARSLAST(ZZ);
WQG:=CROSS(COUNT(CROSS(MACD<本高/2 AND MACD>0,0.5),ZZ)=1,0.5) AND ZZ>=0;
STICKLINE(MACD>前高 AND 本高>前高 AND BARSLAST(CROSS(MACD<本高/2,0.5))>0 AND
MACD>(前高+本高)/2,MACD,前高,1,0),COLORYELLOW;
前高本高二分位:IF(MACD>0 AND 本高!=前高,DRAWLINE(WQG,(前高+本高)/2,REF(WQG,1),REF((前高+本高)/2,1),1)
,DRAWNULL),COLORC0C000,DOTLINE;
AA:STRCAT(STRCAT(STRCAT('〖','上升空间'),'〗'),CON2STR(IF(空间评估,空间评估,
DRAWNULL),2)),NODRAW;
DRAWTEXT(WQG,MACD*1.1,'高成'),COLORWHITE;
DRAWTEXT(BDCL,MACD*1.1,'低成'),COLORWHITE;
STICKLINE(MACD>前高,MACD,前高,0,0),COLORYELLOW;
STICKLINE(WQG,MACD,0,1,0),COLORGREEN;
STICKLINE(MACD<0 AND MACD<前低 AND 前低<0,MACD,前低,0,0),COLORBLUE;
B1:=IF(CROSS(MACD<0,0.5),BARSNEXT(BDTJ),DRAWNULL);
TSB1:=BARSLAST(MACD>0)-1;
STICKLINE(BARSLAST(BDCL)>=0 AND MACD<前低 AND MACD<0,MACD,前低,1,0),COLORGREEN;
STICKLINE(BDCL,MACD,0,1,0),COLORWHITE;
STICKLINE(MACD>前高 AND 本高>前高 AND BARSLAST(WQG)>0,
MACD,前高,1,0),COLORRED;
{DRAWTEXT(VA2 AND VA2!=UU,(MACD/10)*9,'前');}
DRAWTEXT(VA2 AND VA2!=UU,MACD/10,'高');
{DRAWTEXT(ZZ,(MACD/10)*9,'本'),COLORWHITE;
DRAWTEXT(ZZ,MACD/10,'高'),COLORWHITE;}
DRAWTEXT(BDTJ,(MACD/10)*9,'低'),COLORRED;
{DRAWTEXT(BDTJ,MACD/10,'本'),COLORRED;}
IF(BARSLAST(BDCL)>=0,本低/2,DRAWNULL),COLORRED,DOTLINE;

DRAWTEXT_FIX(1,0,0,0,'【黑马拉升由两个阶段构成:同步上涨阶段(黄芯柱)
和惯性上涨阶段(背离阶段、红芯柱)】'),COLORMAGENTA;





回复

举报

QQ|

GMT+8, 2024-11-19 14:39

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