均线粘合很少有百分百相等的情况,可以取1%振幅内粘合,并且一般是3条均线。
源码如下:
X1:=ABS(MA(C,10)/MA(C,20)-1)<0.01;
X2:=ABS(MA(C,5)/MA(C,10)-1)<0.01;
X3:=ABS(MA(C,5)/MA(C,20)-1)<0.01;
MA(C,5)>REF(MA(C,5),1) AND X1 AND X2 AND X3;
所谓的均线粘合就是5、10、20、30、60、90、120、250日中有两条或三条、四条、五条、六条移动平均成本接近相同,或相差不大。例如三线粘合,我们只需要比较出这三条线中的最大成本和最小成本,把最大成本值和最小成本值之间的差距定义为某一个窄幅波动范围就可以了。
MA1:=MA(CLOSE,5);
MA2:=MA(CLOSE,10);
MA3:=MA(CLOSE,20);
MA4:=MA(CLOSE,60);
MA5:=MA(CLOSE,120);
MA6:=MA(CLOSE,250);
A:MAX(MAX(MA1,MA2),MA3),LINETHICK0;
B:MIN(MIN(MA1,MA2),MA3),LINETHICK0;
三线粘合:IF(RANGE(100*(A-B)/B,0,5),100*(A-B)/B,DRAWNULL),LINETHICK0;
SA:MAX(MAX(MA1,MA2),MAX(MA3,MA4)),LINETHICK0;
SB:MIN(MIN(MA1,MA2),MIN(MA3,MA4)),LINETHICK0;
四线粘合:IF(RANGE(100*(SA-SB)/SB,0,10),100*(SA-SB)/SB,DRAWNULL),LINETHICK0;
WA:MAX((MAX(MA1,MA2),MAX(MA3,MA4)),MA5),LINETHICK0;
WB:MIN((MIN(MA1,MA2),MIN(MA3,MA4)),MA5),LINETHICK0;
五线粘合:IF(RANGE(100*(WA-WB)/WB,0,15),100*(WA-WB)/WB,DRAWNULL),LINETHICK0;
LA:MAX((MAX(MA1,MA2),MAX(MA3,MA4)),MAX(MA5,MA6)),LINETHICK0;
LB:MIN((MIN(MA1,MA2),MIN(MA3,MA4)),MIN(MA5,MA6)),LINETHICK0;
六线粘合:IF(RANGE(100*(LA-LB)/LB,0,20),100*(LA-LB)/LB,DRAWNULL),LINETHICK0;
均线粘合:
tj1:=max(max(max(ma(c,5),ma(c,10)),ma(c,20)),ma(c,30));
tj2:=min(min(min(ma(c,5),ma(c,10)),ma(c,20)),ma(c,30));
tj1/tj2<1.01;
均线多头排列、均线粘合,且股价刚刚过年线
m:=(MA(CLOSE,5)+MA(CLOSE,10)+MA(CLOSE,20)+MA(CLOSE,30))/4;
MA(CLOSE,5)>MA(CLOSE,10)&&
MA(CLOSE,10)>MA(CLOSE,20)&&
MA(CLOSE,20)>MA(CLOSE,30)&&
ABS(MA(CLOSE,5)-MA(CLOSE,30))/m<0.05&&
ABS(CLOSE-m)/m<0.05&&
CLOSE>MA(CLOSE,5)&&
CLOSE>MA(CLOSE,250)&&
ABS(CLOSE-MA(CLOSE,250))/MA(CLOSE,250)<0.05;
修改的均线粘合公式
(主图叠加指标)
EMA5:=MA(C,M1);
EMA10:=MA(C,M2);
EMA20:=MA(C,M3);
EMA60:=MA(C,M4);
EMA90:=MA(C,M5);
EMA120:=MA(C,M6);
EMA240:=MA(C,M7);
短线均线粘合:=MAX(EMA5,EMA10)/MIN(EMA5,EMA10)*100<NAND
MAX(EMA5,EMA20)/MIN(EMA5,EMA20)*100<N AND
MAX(EMA5,EMA60)/MIN(EMA5,EMA60)*100<N AND
MAX(EMA10,EMA20)/MIN(EMA10,EMA20)*100<N AND
MAX(EMA10,EMA60)/MIN(EMA60,EMA60)*100<N AND
MAX(EMA20,EMA60)/MIN(EMA20,EMA60)*100<N;
DRAWTEXT(短线均线粘合,c*1.1,'短线均线粘合');
中线均线粘合:=MAX(EMA20,EMA60)/MIN(EMA20,EMA60)*100<NAND
MAX(EMA20,EMA90)/MIN(EMA20,EMA90)*100<N AND
MAX(EMA20,EMA120)/MIN(EMA20,EMA120)*100<N AND
MAX(EMA60,EMA90)/MIN(EMA60,EMA90)*100<N AND
MAX(EMA60,EMA120)/MIN(EMA60,EMA120)*100<N AND
MAX(EMA90,EMA120)/MIN(EMA90,EMA120)*100<N;
DRAWTEXT(中线均线粘合,c*1.1,'中线均线粘合');
中长线均线粘合:=MAX(EMA60,EMA90)/MIN(EMA60,EMA90)*100<NAND
MAX(EMA60,EMA120)/MIN(EMA60,EMA120)*100<N AND
MAX(EMA60,EMA240)/MIN(EMA60,EMA240)*100<N AND
MAX(EMA90,EMA120)/MIN(EMA90,EMA120)*100<N AND
MAX(EMA90,EMA240)/MIN(EMA90,EMA240)*100<N AND
MAX(EMA120,EMA240)/MIN(EMA120,EMA240)*100<N;
DRAWTEXT(中长线均线粘合,c*1.1,'中长线均线粘合'); |