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

 找回密码
 注册昵称

QQ登录

只需一步,快速开始

搜索
上一主题 下一主题

[同花顺] 同花顺MACD面积副图指标 源码


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

同花顺MACD面积副图指标 源码

MACD面积调试,分红绿柱子面积,计算大小差异

SHORT:=12;
LONG:=26;
M:=9;

DIFF:EMA(CLOSE,Short) - EMA(CLOSE,Long);
DEA:EMA(DIFF,M);
MACD:2*(DIFF-DEA),COLORSTICK;
MACDHS:=IF(MACD>0 AND MACD>REF(MACD,1),MACD,0);
MACDHX:=IF(MACD>0 AND MACD<REF(MACD,1),MACD,0);
MACDLX:=IF(MACD<0 AND MACD<REF(MACD,1),MACD,0);
MACDLS:=IF(MACD<0 AND MACD>REF(MACD,1),MACD,0);
红柱面积:=IF(MACD>0,SUM(MACD,BARSLAST(MACD<0)),0),PRECIS2,COLOR0000FF;
绿柱面积:=IF(MACD<0,SUM(MACD,BARSLAST(MACD>0)),0),PRECIS2,COLOR006000;
//MACD面积:IF(MACD<0,ABS(绿柱面积),ABS(红柱面积)),NODRAW;
DRAWTEXT(REF(MACD,1)>0 AND MACD<=0 ,HHV(MACD,4),TOSTRING(REF(红柱面积,1),3)),colorred;
DRAWTEXT(REF(MACD,1)<0 AND MACD>=0 ,LLV(MACD,4),TOSTRING(REF(ABS(绿柱面积),1),3)),Color00ff00;
DRAWTEXT(ISNULL(REFX(&CLOSE,1))=1 AND MACD<0,LLV(MACD,4),TOSTRING(ABS(绿柱面积),3)),Color004A00;
DRAWTEXT(ISNULL(REFX(&CLOSE,1))=1 AND MACD>0,HHV(MACD,4),TOSTRING(ABS(红柱面积),3)),colorred;
BV:=SUM(MACD,0);
BA:=IF(MAX(BV,REF(BV,2))<REF(BV,1) OR MIN(BV,REF(BV,2))>REF(BV,1),1,0);
BC:=BARSLAST(BA)+1;
面积:=BV-REF(BV,BC); DIFF:EMA(CLOSE,Short) - EMA(CLOSE,Long);
DEA:EMA(DIFF,M);
MACD:2*(DIFF-DEA),COLORSTICK;
MACDHS:=IF(MACD>0 AND MACD>REF(MACD,1),MACD,0);
MACDHX:=IF(MACD>0 AND MACD<REF(MACD,1),MACD,0);
MACDLX:=IF(MACD<0 AND MACD<REF(MACD,1),MACD,0);
MACDLS:=IF(MACD<0 AND MACD>REF(MACD,1),MACD,0);
红柱面积:=IF(MACD>0,SUM(MACD,BARSLAST(MACD<0)),0),PRECIS2,COLOR0000FF;
绿柱面积:=IF(MACD<0,SUM(MACD,BARSLAST(MACD>0)),0),PRECIS2,COLOR006000;
//MACD面积:IF(MACD<0,ABS(绿柱面积),ABS(红柱面积)),NODRAW;
DRAWTEXT(REF(MACD,1)>0 AND MACD<=0 ,HHV(MACD,4),TOSTRING(REF(红柱面积,1),3)),colorred;
DRAWTEXT(REF(MACD,1)<0 AND MACD>=0 ,LLV(MACD,4),TOSTRING(REF(ABS(绿柱面积),1),3)),Color00ff00;
DRAWTEXT(ISNULL(REFX(&CLOSE,1))=1 AND MACD<0,LLV(MACD,4),TOSTRING(ABS(绿柱面积),3)),Color004A00;
DRAWTEXT(ISNULL(REFX(&CLOSE,1))=1 AND MACD>0,HHV(MACD,4),TOSTRING(ABS(红柱面积),3)),colorred;
BV:=SUM(MACD,0);
BA:=IF(MAX(BV,REF(BV,2))<REF(BV,1) OR MIN(BV,REF(BV,2))>REF(BV,1),1,0);
BC:=BARSLAST(BA)+1;
面积:=BV-REF(BV,BC)
 


 




 



gd48884

回复

举报

QQ|

GMT+8, 2024-11-18 20:01

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