AVEC:=(2*C+H+L)/4;
MID:=(3*CLOSE+LOW+OPEN+HIGH)/6;
DKX:=(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)+
10*REF(MID,10)+9*REF(MID,11)+8*REF(MID,12)+
7*REF(MID,13)+6*REF(MID,14)+5*REF(MID,15)+
4*REF(MID,16)+3*REF(MID,17)+2*REF(MID,18)+REF(MID,20))/210;
AA05:=MA(C,5);
AA13:=MA(C,13);
AACP:=DKX;
AA21:=MA(C,21);
AA34:=MA(C,34);
AADK:=(MA(AVEC,5)+MA(AVEC,10)+MA(AVEC,20)+MA(AVEC,60))/4;
五日乖离率:=(C-AA05)/AA05*100;
BB05:=ATAN((AA05/REF(AA05,1)-1)*100)*180/3.1416;
BBCP:=ATAN((AACP/REF(AACP,1)-1)*100)*180/3.1416;
BB21:=ATAN((AA21/REF(AA21,1)-1)*100)*180/3.1416;
BB34:=ATAN((AA34/REF(AA34,1)-1)*100)*180/3.1416;
bbdK:=ATAN((AADK/REF(AADK,1)-1)*100)*180/3.1416;
速度5:=SMA(EMA((AA05-REF(AA05,1))/REF(AA05,1),3)*100,3,1);
加速度5:=EMA((速度5-REF(速度5,1)),3);
MCP:=DKX;
操盘线:DKX,COLORWHITE,LINETHICK2;
M5:MA(C,5),COLOR00FF00;
M34:MA(C,34),COLORFF33CC;
多空线:(MA(AVEC,5)+MA(AVEC,10)+MA(AVEC,20)+MA(AVEC,60))/4,POINTDOT,COLOR0044FF,LINETHICK4;
STICKLINE(BB05>30 AND AA05>REF(AA05,1), AA05,REF(AA05,1),8,1),COLORYELLOW;
STICKLINE(BB05<0 AND AA05<REF(AA05,1), AA05,REF(AA05,1),8,1),COLOR00FF00;
三拾日乖离率:=(C-AA34)/AA34*100;
bias5%:(C-MA(C,5))/MA(C,5)*100,NODRAW;
BIASCP%:(C-MCP)/MCP*100,NODRAW;
BIAS34%:(C-MA(C,34))/MA(C,34)*100,NODRAW;
B5度:BB05,NODRAW;
BCP度:BBCP,NODRAW;
B21度:BB21,NODRAW;
B34度:BB34,NODRAW;
BDK度:BBDK,NODRAW;
VAR1:=(AA21-AA34)>REF((AA21-AA34),1) AND AA21>REF(AA21,1) AND AA34>REF(AA34,1);
VAR2:=(AA34-AA21)<REF((AA34-AA21),1) AND AA21<REF(AA21,1) AND AA34<REF(AA34,1);
STICKLINE(BB34>15 AND AA34>REF(AA34,1), AA34,REF(AA34,1),8,1),COLORFF33CC;
强势狙击:=FILTER(BB34>30 AND BBCP>45 AND crOSS(BB05,60),10);
加仓:=FILTER(COUNT(CROSS(BB05,30),5)>=1 AND AA05>REF(AA05,1) AND 三拾日乖离率>REF(三拾日乖离率,1) AND AA13>REF(AA13,1)
AND 加速度5>REF(加速度5,1) AND 速度5>REF(速度5,1) ,10) ;
清仓:=FILTER(COUNT(CROSS(30,BB05),5)>=1 AND (C>AA34 OR O>AA34) AND AA05<REF(AA05,1) AND 三拾日乖离率<REF(三拾日乖离率,1) AND AA13<REF(AA13,1),10);
DRAWTEXT(加仓 ,LOW*0.98,'←加仓'),COLORRED;
JC:=CROSS(0,五日乖离率) AND 三拾日乖离率<REF(三拾日乖离率,1) AND AA13>REF(AA13,1) ;
减仓:=FILTER(JC,10);
MR:=COUNT(CROSS(五日乖离率,0),3)>=1 AND 三拾日乖离率>REF(三拾日乖离率,1) AND AA05>REF(AA05,1) AND (C/REF(C,1)-1)*100>5 AND REF(C,1)<AA34;
买入:=FILTER(MR,10);
DRAWTEXT(减仓,HIGH*1.02,'←减仓'),COLORCYAN;
DRAWTEXT(买入,LOW*0.98,'★买入'),COLORYELLOW;
DRAWTEXT(清仓 ,HIGH*1.02,'★清仓'),COLORGREEN;
DRAWTEXT(强势狙击,LOW*0.98,'←强势狙击'),COLORYELLOW;
VAR21:=MAX(Abs(HIGH-AMOUNT/vol/100),ABS(AMOUNT/VOL/100-LOW));
VAR3:=ABS((OPEN+CLOSE)/2-AMOUNT/VOL/100);
MV:=(VAR21+VAR3)/AMOUNT*VOL*100*50;
DRAWTEXT(MV>6 AND L<=LLV(L,10),L*0.95,'←异动'),COLORCYAN;