//背离结构
diff : ema(close,short) - ema(close,long),colorwhite;
dea : ema(diff,m),coloryellow;
macd=2*(diff-dea);
zero : 0;
gj:=max(c,o);
l4:=llv(gj,4);
jl:=(hhv(diff,55)-llv(diff,55))/5;
gt:=dea>ref(dea,1) and ref(dea,1)<ref(dea,2);
a1:=barslast(ref(gt,1));//www.goodgongshi.com
stickline(macd>0 and macd>=ref(macd,1),0,macd,2,0),color0000ff;
stickline(macd>0 and macd<ref(macd,1),0,macd,2,0),colorffff00;
stickline(macd<0 and macd>=ref(macd,1),0,macd,2,0),colorff00ff;
stickline(macd<0 and macd<ref(macd,1),0,macd,2,0),color00ff00;
底背离:=ref(l4,a1+1)>close and diff>ref(diff,a1+1) and gt;
drawline(a1=0,dea,底背离,ref(dea,a1),0),colorred,linethick2;
drawline(底背离,dea,底背离,ref(dea,a1),0),colorred,linethick2;
drawtext(底背离,ref(dea,a1)*1.18,' 底背离'),colorff00ff;
h4:=hhv(gj,4);//www.goodgongshi.com
gt2:=dea<ref(dea,1) and ref(dea,1)>ref(dea,2);
a2:=barslast(ref(gt2,1));
顶背离:= ref(h4,a2+1)<h4 and diff<ref(diff,a2+1) and gt2;
drawline(a2=0 ,dea,顶背离,ref(dea,a2),0),colorgreen,linethick2;
drawline(顶背离,dea,顶背离,ref(dea,a2),0),colorgreen,linethick2;
drawtext(顶背离,ref(dea,a2)*1.18,' 顶背离'),colorgreen;
死叉:=cross(dea,diff);
drawicon(死叉,diff*0.95,'2');
n1:barslast(死叉),nodraw;
n2:ref(barslast(死叉),n1+1),nodraw;
n3:ref(barslast(死叉),n2+n1+2),nodraw;
cl1:=llv(c,n1+1),nodraw;
difl1:=llv(diff,n1+1),nodraw;
cl2:=ref(cl1,n1+1),nodraw;
difl2:=ref(difl1,n1+1),nodraw;
cl3:=ref(cl2,n1+1),nodraw;
difl3:=ref(difl2,n1+1),nodraw;
pdifl2:=if(difl2>0,intpart(log(difl2))-1,intpart(log(-difl2))-1);
mdifl2:=intpart(difl2/pow(10,pdifl2));
pdifl3:=if(difl3>0,intpart(log(difl3))-1,intpart(log(-difl3))-1);
mdifl3:=intpart(difl3/pow(10,pdifl3));
mdifb2:=intpart(diff/pow(10,pdifl2));
mdifb3:=intpart(diff/pow(10,pdifl3));
直接底背离:=(cl1<cl2 ) and (mdifb2>mdifl2) and (macd<0 and ref(macd,1)<0) and mdifb2<=ref(mdifb2,1);
隔峰底背离:=(cl1<cl3 and cl3<cl2 ) and (mdifb3>mdifl3) and (macd<0 and ref(macd,1)<0) and mdifb3<=ref(mdifb3,1);
b:直接底背离 or 隔峰底背离,nodraw;
bg:((mdifb2>ref(mdifb2,1))*ref(直接底背离,1)) or ((mdifb3>ref(mdifb3,1))*ref(隔峰底背离,1)),nodraw;
底背离消失:=(ref(直接底背离,1) and difl1<=difl2 ) or (ref(隔峰底背离,1) and difl1<=difl3);
stickline(b or bg,diff,dea,8,0),colorred,linethick2;
drawtext((b and count(b,2)=1),(diff*1.5),'钝'),coloryellow;
drawtext(filter(bg,10),diff*1.5,'成'),colormagenta;
drawtext(filter(底背离消失,10),(diff+macd),'失'),colorgreen;
stickline(bg,0,diff+dea,5,0),colorred,linethick3;
金叉:=cross(diff,dea);
drawicon(金叉,diff*0.95,'1');
m1:=barslast(金叉),nodraw;
m2:=ref(barslast(金叉),m1+1);
m3:=ref(barslast(金叉),m2+m1+2);
ch1:=hhv(c,m1+1),nodraw;
difh1:=hhv(diff,m1+1),nodraw;
ch2:=ref(ch1,m1+1),nodraw;
difh2:=ref(difh1,m1+1),nodraw;
ch3:=ref(ch2,m1+1),nodraw;
difh3:=ref(difh2,m1+1),nodraw;
pdifh2:=if(difh2>0,intpart(log(difh2))-1,intpart(log(-difh2))-1);
mdifh2:=intpart(difh2/pow(10,pdifh2));
pdifh3:=if(difh3>0,intpart(log(difh3))-1,intpart(log(-difh3))-1);
mdifh3:=intpart(difh3/pow(10,pdifh3));
mdift2:=intpart(diff/pow(10,pdifh2));
mdift3:=intpart(diff/pow(10,pdifh3));
直接顶背离:=(ch1>ch2 ) and (mdift2<mdifh2) and (macd>0 and ref(macd,1)>0) and mdift2>=ref(mdift2,1);
隔峰顶背离:=(ch1>ch3 and ch3>ch2 ) and (mdift3<mdifh3) and (macd>0 and ref(macd,1)>0) and mdift3>=ref(mdift3,1);
t:=直接顶背离 or 隔峰顶背离,nodraw;
tg:=((mdift2<ref(mdift2,1))*ref(直接顶背离,1)) or ((mdift3<ref(mdift3,1))*ref(隔峰顶背离,1)),nodraw;
顶背离消失:=(ref(直接顶背离,1) and difh1>=difh2 ) or (ref(隔峰顶背离,1) and difh1>=difh3);
stickline(tg,0,diff+dea,5,0), colorgreen,linethick4;
stickline(t or tg,diff,dea,8,0),colorgreen,linethick2;
drawtext(filter(tg,20),diff*1.4,'成'),colormagenta;
drawtext(filter(顶背离消失,20),(diff+macd),'失'),colorgreen;
上一指标公式:短轨9指标详解 同花顺
下一指标公式:底部买入有未来函数指标详解 同花顺函数未来
☉ 好公式网发布的指标公式主要用于软件技术面分析,仅供参考,勿用于实际操作,据此操作风险自负!
☉ 解压密码:www.goodgongshi.com 就是好公式网域名,希望大家看清楚,切勿输错。
☉ tnc和tni格式指标公式,仅可以用通达信软件引入使用,例如可以用通达信软件引入使用指标公式;
☉ tne格式指标公式,仅可以用通达信软件公式编辑器5.0版导入,高版本兼容低版本;
☉ fnc格式指标公式,可以用大智慧软件新一代高速行情分析系统股票软件使用,少部分可以用分析家软件引入使用;
☉ alg格式指标公式,仅仅可以用飞狐交易师软件引入使用;exp格式指标公式,仅可以用大智慧经典版软件引入使用;
☉ hxf格式指标公式,仅可以用同花顺软件引入使用。
☉ 如果您发现下载软件链接错误,请联系管理员报告错误。
☉ 好公式网欢迎各位网友帮忙宣传转发本站网址,有您的支持,我们会做得更好!
☉ 本文背离结构指标详解 同花顺背离仅供学习研究。