同花顺MACD背离图案副图源码

用法同macd
 MACD指标说明
MACD指数平滑异同移动平均线为两条长、短的平滑平均线。
 其买卖原则为:
1.DIFF、DEA均为正,DIFF向上突破DEA,买入信号参考。
2.DIFF、DEA均为负,DIFF向下跌破DEA,卖出信号参考。
3.DEA线与K线发生背离,行情可能出现反转信号。
4.分析MACD柱状线,由红变绿(正变负),卖出信号参考;由绿变红,买入信号参考。

N:=21;M:=11;
 DIFF1:=EMA(CLOSE,12)-EMA(CLOSE,27);
 DEA1:=EMA(DIFF1,9);
 MACD:=2*(DIFF1-DEA1),STICK;
 DRAWBAND(DIFF1,RGB(200,50,55),DEA1,RGB(0,100,50));
 DIFF:DIFF1,COLOR33FF33;
 DEA:DEA1,coloryellow;
 STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,0.9,0),COLORFF8B00;
 STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,0.3,0),COLORFFAB00;
 STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,0.9,0),COLOR0000DD;
 STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,0.3,0),COLOR0000FF;
 STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,0.9,0),COLORDDDDDD;
 STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,0.3,0),COLORFFFFFF;
 STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,0.9,0),COLORFF8B00;
 STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,0.3,0),COLORFFAB00;
 STICKLINE(MACD>=0 OR MACD<=0,0,0,50,2),colorwhite;
金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;
 DRAWICON(金叉,DEA,23);
 DRAWTEXT(金叉,DEA,' 低金'),coloryellow;
 JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
二金:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
 DRAWICON(二金,DEA*1.04,13) ;
 DRAWTEXT(二金,-0.1,' 二金'),COLORFF00FF;
 A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
底背:DRAWLINE(A1=0,DEA,底背离,DEA,0),colorred,POINTDOT;
 DRAWTEXT(底背离,-0.2,'底背'),colormagenta;
 A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),colorgreen,POINTDOT;
 DRAWTEXT(顶背离,DIFF,'顶背'),colorgreen;
 AA:=REF(HHV(HIGH,N),1);
 BB:=REF(LLV(LOW,N),1);
 GG:=(AA+BB)/2;
 TJ1:=(AA-BB)/GG<(M/100);
 TJ2:=C>REF(HHV(HIGH,N),1);
 XG:=TJ1 AND TJ2;
 LB:=V/REF(V,1)>2;
 W88:金叉 AND XG AND LB;
 STICKLINE(W88,0,0.2,3,0),COLOR00FFFF;




来函数检测结果如下:
该公式没有未来函数

解密、定制、编写股票指标请联系QQ或微信同号:88652583
相关股票指标公式

联系我们  |  股票指标网  |  指标网   |  指标公式  |   加入收藏   |  设为主页

@2005-2023 粤ICP备2023063687号-2 股票指标网别名指标网仅为互联网文章,所有股票指标公式及文章仅供学习研究,并不构成投资建议,请勿以此为依据进行股票交易,由此引起的投资亏损与本站无关。股票指标网均来源互联网收集整理,如不慎侵犯了你的权益,请联系我们告知,我们将做删除处理
QQ:88652583 微信 88652583
sitemap站点地图