老师有没有macd顶底背离技术指标公式?(就是技术大讲堂里讲的那个)
孙君答DIFF:=EMA(CLOSE,12) - EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA);
{======================================================}
cond1:=longcross(dea,diff,3);
cond2:=longcross(diff,dea,3);
var1:=barslast(cond1);
var2:=ref(var1,var1+1)+1;
var3:=barslast(cond2);
var4:=ref(var3,var3+1)+1;
var5:=ref(var3,var1)+1;
macdtop1:=ref(hhv(diff,var5),var1);
top1:=ref(hhv(high,var5),var1);
var6:=ref(var3,var1+var2)+1;
macdtop2:=ref(hhv(diff,var6),var1+var2);
top2:=ref(hhv(high,var6),var1+var2);
顶背离0:=top1>top2 and macdtop1<macdtop2;
顶背离:=顶背离0>ref(顶背离0,1);
var7:=ref(var1,var3)+1;
macdbase1:=ref(llv(diff,var7),var3);
base1:=ref(llv(low,var7),var3);
var8:=ref(var1,var3+var4)+1;
macdbase2:=ref(llv(diff,var8),var3+var4);
base2:=ref(llv(low,var8),var3+var4);
底背离0:=base1<base2 and macdbase1>macdbase2;
底背离:=底背离0>ref(底背离0,1);
底背离=1;
如果觉得《macd顶底背离技术指标公式》对你有帮助,请点赞、收藏,并留下你的观点哦!