MID:=(CLOSE+LOW+OPEN+HIGH)/4;
主力:(20*MID+19*REF(MID,1)+18*REF(MID,2)+17*REF(MID,3)+
16*REF(MID,4)+15*REF(MID,5)+14*REF(MID,6)+
13*REF(MID,7)+12*REF(MID,8)+11*REF(MID,9)+MID)/2,COLORWHITE;
主力买:IF(主力>REF(主力,2),主力,DRAWNULL),COLORWHITE,LINETHICK2;
主力卖:IF(主力<REF(主力,2),主力,DRAWNULL),COLORCYAN,LINETHICK2;
bias1:=(C-ema(C,10))/ema(C,10);
BIAS2:=(C-EMA(C,20))/EMA(C,20);
BIAS3:=(C-EMA(C,55))/EMA(C,55);
乖离1:=(BIAS1+5*BIAS2+10*BIAS3);
乖离2:EMA(主力+乖离1,5),NODRAW ;
乖离3:EMA(主力+乖离1+乖离2,15)/2,NODRAW ;
乖离买:IF(乖离2>REF(乖离2,2),乖离2,DRAWNULL),COLORWHITE,LINETHICK2,NODRAW ;
乖离卖:IF(乖离2<REF(乖离2,2),乖离2,DRAWNULL),COLORCYAN,NODRAW ;
连续乖离:=乖离2>REF(乖离2,1) AND REF(乖离2,1)>REF(乖离2,2) AND REF(乖离2,2)>REF(乖离2,3) AND crOSS(乖离1,0);
主力买1:=IF(乖离2>REF(乖离2,3),乖离2,DRAWNULL),COLORWHITE;
主力买2:=IF(乖离2<REF(乖离2,2),乖离2,DRAWNULL),COLORCYAN;
stICKLINE(主力买1,乖离2,乖离3,3,0),COLORWHITE;
STICKLINE(主力买2,乖离2,乖离3,3,0),COLORCYAN;
{换手Z:vol/FInaNCE(46)*10000,NODRAW,COLORWHITE;}
IF(主力买>=REF(乖离3,2),主力买,DRAWNULL),COLORWHITE,LINETHICK3;
IF(主力买<=REF(乖离2,1),主力买,DRAWNULL),COLORCYAN,LINETHICK2;
DRAWTEXT(CROSS(主力买,乖离2) AND CROSS(C,MA(C,10)),乖离2,'初显'),COLORFFFFA6;
DRAWTEXT(CROSS(主力买,乖离2) AND CROSS(C,MA(C,60)),乖离3,'牛妖'),COLOR51E3E8;