D1:=12;
D2:=26;
D3:=9;
DIF:EMA(CLOSE,D1)-EMA(CLOSE,D2);
DEA:EMA(DIF,D3);
MACD:2*(DIF-DEA), COLORSTICK,LINETHICK2;
低位金叉:=CROSS(DIF,DEA) AND DIF<-0.1;
STICKLINE(低位金叉,0,0.12,4,0),COLORYELLOW;
DRAWTEXT(低位金叉,0.1,' 低位金叉'),COLORWHITE;
JCCOUNT:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0));
二次金叉:=CROSS(DIF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,30)=1;
STICKLINE(二次金叉,0,0.06,4,0),COLORFF00FF;
DRAWICON(二次金叉,DEA*0.9,1) ;
DRAWTEXT(二次金叉,0.3,' 二次金叉'),COLORYELLOW;
A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
{上一次昨日MACD金叉到当日周期数。}
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIF>REF(DIF,A1+1) AND CROSS(DIF,DEA) AND DEA<0;
{上次金叉时的收盘价>当日收盘价,股价创新低,当日MACD金叉点却未创新低,形成底背离 ,并且在0轴之下。}
STICKLINE(底背离,0,0.03,6,0),COLOR00FF00;
底背:DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK4;
{第一次金叉为起点,出现底背离的第二次金叉为终点,画线段。}
DRAWTEXT(底背离,-0.15,' 底背离'),COLORFF00FF;
A2:=BARSLAST(REF(CROSS(DEA,DIF),1));
顶背离:=REF(CLOSE,A2+1)
DRAWTEXT(顶背离,0.3,' 顶背离'),COLORGREEN;
顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK4;
Copyright 2018- www.dyjian.com/ 大宇股票知识网 海口美兰韩哲棚百货商行 版权所有 琼ICP备2023001966号
免责声名:本站所发表的内容仅用于学术交流和学习,内容所带来的一切后果均与本站无关。若您发现本站存在您非授权的原创作品,请第一时间联系本站删除!