均线角度macd-(有背离指示 源码)

[复制链接]
查看159 | 回复0 | 2022-7-13 07:32:00 | 显示全部楼层 |阅读模式
用均线角度生成的MACD有一个最大的好处就是可以通过指标排序,把所有的股票进行分类比较,从而为轮动操作提供有力的保障。如近期大盘已经跌破年线,要把所有在年线获得支撑的股票都找出来只需把公式中的ANG2排一下序,在[-5,0]的就是在年线有支撑的,而在[0,5]的就更强一点,在233日至144日线之间。
用均线角度生成的MACD另一个好处就是对背驰更为灵敏。 m1:=ema(c,89);
m2:=ema(c,26);
m3:=ema(c,12);
m4:=ema(c,233);
a1:=atan((m1/ref(m1,1)-1)*100)*100;
a2:=atan((m2/ref(m2,1)-1)*100)*100;
a3:=atan((m3/ref(m3,1)-1)*100)*100;
a4:=atan((m4/ref(m4,1)-1)*100)*100;
ang1:ema(a1,m),,COLORgreen;
ang2:ema(a4,m),coloraa00aa;
//ang2:=atan((ref(ang1,1)/ang1-1)*100)*20;
//ang3:ema(ang2,34),linethick2;
DEA:ema(a2,m),coloryellow;
DIFF:ema(a3,m),COLORwhite;
partline(ang1>0,ang1),colorred;
//partline(between(ang1,-3,3),ang1),coloraa11aa;
macd:1.5*(DIFF-DEA),colorstick;
b1:=cross(0,dea);
b2:=cross(dea,0);
b3:=cross(0,macd);
b4:=cross(macd,0);
b5:=count(last(macd>0,2,4) and b3,barslast(b1));
b6:=llv(dea,barslast(b3))>llv(dea,barslast(b1)) or llv(diff,barslast(b3))>llv(diff,barslast(b1));
b7:=l<=llv(l,sumbars(b1,2))*1.001 and ref(ang1,llvbars(l,sumbars(b1,2)))<-4;
b8:=llv(macd,barslast(b3))>llv(macd,sumbars(b1,2));
b9:=llv(dea,barslast(b3))>llv(dea,sumbars(b1,2)) or llv(diff,barslast(b3))>llv(diff,sumbars(b1,2));
顶背:(b5>1 and b6 and b7) or (b5<=1 and b7 and b8 and b9),linethick0;
stickline(顶背,dea,diff,5,0),colorred; c1:=count(last(macd<0,2,4) and b4,barslast(b2));
c2:=hhv(dea,barslast(b4))<hhv(dea,barslast(b2)) or hhv(diff,barslast(b4))<hhv(diff,barslast(b2));
c3:=h>=hhv(h,sumbars(b2,2))*0.999 and ref(ang1,hhvbars(h,sumbars(b2,2)))>4;
c4:=hhv(macd,barslast(b4))<hhv(macd,sumbars(b2,2));
c5:=hhv(dea,barslast(b4))<hhv(dea,sumbars(b2,2)) or hhv(diff,barslast(b4))<hhv(diff,sumbars(b2,2));
底背:(c1>1 and c2 and c3) or (c1<=1 and c3 and c4 and c5),linethick0;
stickline(底背,dea,diff,5,0),colorgreen;

201061010103245352.gif

201061010103245352.gif

 

201061010105417716.rar

2.7 KB, 下载次数: 2

201061010105417716.rar

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则