您的位置:股票站 > 查股公式 > 通达信MACD双背离(源码副图)[查股公式]
股票行情消息数据:

通达信MACD双背离(源码副图)[查股公式]

2022/8/17 14:36:13

发一个MACD双背离指标
 
macd双背离

DIFF: EMA(CLOSE,12) - EMA(CLOSE,26);
DEA: EMA(DIFF,9);
MACD: 2*(DIFF-DEA),COLORSTICK;
JC:=DEA-DIFF;
绿柱面积:=IF(MACD<0,SUM(MACD,BARSLAST(JC<0)),0);
红柱面积:=IF(MACD>0,SUM(MACD,BARSLAST(JC>0)),0);
本次最低价:=LLV(L,BARSLAST(JC<0));
本次最高价:=HHV(H,BARSLAST(JC>0));
X1:=IF (MACD<0,BARSLAST(CROSS(DIFF,DEA)),0);
前次绿柱面积:=REF(绿柱面积,X1+1);
前次最低价:=REF(本次最低价,X1+1);
Y1:=IF((绿柱面积<0 AND ABS(绿柱面积)<ABS(前次绿柱面积)
AND 本次最低价<前次最低价 ),1,0);
RS1:= MACD<0 AND REF(MACD,1)<0 AND C<前次最低价
AND ABS(绿柱面积)<ABS(前次绿柱面积) AND ABS(MACD)<ABS(REF(MACD,1));
底背驰:= IF (CROSS(DIFF,DEA),REF(Y1,1),0);
DRAWTEXT(底背驰,-0.01,'积底'),COLORRED;
{DRAWBAND(DIFF,RGB(200,50,55),DEA,RGB(50,100,10));}
X2:=IF (MACD>0,BARSLAST(CROSS(DEA,DIFF)),0);
前次红柱面积:=REF(红柱面积,X2+1);
前次最高价:=REF(本次最高价,X2+1);
Y2:=IF((红柱面积>0 AND 红柱面积<前次红柱面积 AND 本次最高价>前次最高价 ),1,0);
RS2:= MACD>0 AND REF(MACD,1)>0 AND C>前次最高价 AND ABS(红柱面积)<ABS(前次红柱面积) AND ABS(MACD)<ABS(REF(MACD,1));
顶背驰:= IF (CROSS(DEA,DIFF),REF(Y2,1),0);
DRAWTEXT(顶背驰,0.01,'积顶'),COLORGREEN;
A11:=BARSLAST(REF(CROSS(DIFF,DEA),1));
JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
底背离:=REF(CLOSE,A11+1)>CLOSE AND DIFF>REF(DIFF,A11+1) AND CROSS(DIFF,DEA);
DRAWTEXT(底背离,DEA,' 线底'),COLORRED;
A22:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,A22+1)<CLOSE AND REF(DIFF,A22+1)>DIFF AND CROSS(DEA,DIFF);
DRAWTEXT(顶背离,DEA,'线顶'),COLORGREEN;

A1:=DIFF<0 AND DEA<0;
A2:=A1>REF(A1,1);
A3:=BARSLAST(A2);

相关文章列表
天天查股公式列表

股票公式分类

天天查股:股票行情消息 实时DDX在线 资金流向 千股千评 业绩报告 十大股东 最新消息 超赢数据 大小非解禁 停牌复牌 股票分红数据 股票评级报告
广告客服:315126368   843010021
股票站免费查股,本站内容与数据仅供参考,不构成投资建议,据此操作,风险自担,股市有风险,投资需谨慎。 沪ICP备15043930号-29