您的位置:查股网 > 查股公式 > 通达信MACD三背离 副图/选股源码[查股公式]
股票行情消息查询:
大盘云图

通达信MACD三背离 副图/选股源码[查股公式]

2022/5/29 18:39:45

DIF:EMA(CLOSE,12)-EMA(CLOSE,26);
 DEA:EMA(DIF,9);
 MACD:(DIF-DEA)*2,COLORSTICK;
 IF(DIF>DEA,DIF,DRAWNULL) COLORRED ;
 IF(DIF<DEA,DIF,DRAWNULL)COLORGREEN;

A1:=BARSLAST(REF(CROSS("MACD.DIF","MACD.DEA"),1));
 B1:=REF(C,A1+1)>C AND REF("MACD.DIF",A1+1)<"MACD.DIF" AND CROSS("MACD.DIF","MACD.DEA");
 DRAWTEXT(B1>0,-1,'MACD底背'),COLORFF00FF;
 C1:=BARSLAST(REF(CROSS("MACD.DEA","MACD.DIF"),1));
 D1:=REF(C,C1+1)<C AND REF("MACD.DIF",C1+1)>"MACD.DIF" AND CROSS("MACD.DEA","MACD.DIF");
 DRAWTEXT(D1>0,0.4,'MACD顶离'),COLORBLUE;{MACD顶背离}


JC := DEA-DIF;
绿柱面积:=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(DIF,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(DIF,DEA),REF(Y1,1),0);
 DRAWTEXT(底背驰,-0.8,'积底背'),COLOR00FFFF;
 X2:=IF (MACD>0,BARSLAST(CROSS(DEA,DIF)),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,DIF),REF(Y2,1),0);
 DRAWTEXT(顶背驰,0.8,'顶底背'),COLORGREEN;
 MACD高:=HHV(MACD,5);
 E:=REF(C,C1+1)>C AND DEA>0 AND REF(MACD高,C1+1)<MACD高 AND CROSS("MACD.DEA","MACD.DIF") ;
 DRAWTEXT(E>0,0.4,'柱顶背'),COLORRED;
 F:=REF(C,A1+1)>C AND DEA<0 AND REF(MACD高,A1+1)<MACD高 AND CROSS("MACD.DIF","MACD.DEA");
 DRAWTEXT(F>0,-0.3,'柱底背'),COLORYELLOW;
 STICKLINE(COUNT(DIF>DEA,BARSLAST(CROSS(DIF,DEA))+1)=7,0,MACD,1,0),COLORCD7F32;
 STICKLINE(COUNT(DIF>DEA,BARSLAST(CROSS(DIF,DEA))+1)=15,0,MACD,1,0),COLORCD7F32;
 STICKLINE(COUNT(DIF>DEA,BARSLAST(CROSS(DIF,DEA))+1)=28,0,MACD,1,0),COLORCD7F32;
 STICKLINE(COUNT(DIF>DEA,BARSLAST(CROSS(DIF,DEA))+1)=36,0,MACD,1,0),COLORCD7F32;
 STICKLINE(COUNT(DIF>DEA,BARSLAST(CROSS(DIF,DEA))+1)=48,0,MACD,1,0),COLORCD7F32;
 STICKLINE(COUNT(DIF<DEA,BARSLAST(CROSS(DIF,DEA))+1)=7,0,MACD,1,0), COLORE47833;
 STICKLINE(COUNT(DIF<DEA,BARSLAST(CROSS(DIF,DEA))+1)=15,0,MACD,1,0), COLORE47833;
 STICKLINE(COUNT(DIF<DEA,BARSLAST(CROSS(DIF,DEA))+1)=28,0,MACD,1,0) COLORE47833;
 STICKLINE(COUNT(DIF<DEA,BARSLAST(CROSS(DIF,DEA))+1)=36,0,MACD,1,0), COLORE47833;
 STICKLINE(COUNT(DIF<DEA,BARSLAST(CROSS(DIF,DEA))+1)=48,0,MACD,1,0), COLORE47833;

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

股票公式分类

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