MACD 底背离排序指标{源码及附图}介绍
MACD 底背离排序指标{源码及附图}
input: n(10,5,500){背离天数},
long(26,20,100),short(12,5,40),m(9,2,60);{MACD 参数}
DIFF := EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA := EMA(DIFF,M);
MACD := 2*(DIFF-DEA);
c0:=(ref(c,n)-c)/c;
m1:=(macd-ref(macd,n))/abs(macd);
m2:=(DIFF-ref(DIFF,n))/abs(DIFF);
m3:=(DEA-ref(DEA,n))/abs(DEA);
m11:=if(m1>0,m1,0);
m21:=if(m2>0,m2,0);
m31:=if(m3>0,m3,0);
c1:=if(c0>0,c0,0);
MACDdbl:m11*c1;{大于0 即为背离}
DIFFdbl:m21*c1;{大于0 即为背离}
DEAdbl:m31*c1;{大于0 即为背离}
gd17400