MA5:=eMA(C,5);
MA10:=eMA(C,10);
ma24:=ema(c,24);
MA30:eMA(C,43),POINTDOT,colorDD00DD, LINETHICK3;
IF(MA5>MA24,MA24,ma30),COLORGREEN, LINETHICK2;
partline(MA24,MA5>ma24,rgb(0,0,255),MA5<ma24,rgb(0,0,0)),linethick2;
partline(MA5,MA5>=ref(MA5,1),rgb(255,0,0),MA5<ref(MA5,1),rgb(0,250,0)),linethick2;
A7:=(2*C+H+L)/4;
操作:=MA(A7,3);
操作1:=MA(A7,5)*1.03;
操作2:=MA(A7,5)*0.97;
VAR1A:LLV(A7,21);
VAR2A:HHV(A7,21);
AA05:=MA(C,5);
五日乖离率:=(C-AA05)/AA05*100;
BB05:=ATAN((AA05/REF(AA05,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);
AA10:=MA(C,10);AA20:=MA(C,20);
BB10:=ATAN((AA10/REF(AA10,1)-1)*100)*180/3.1416;
AA30:=MA(C,30);
三拾日乖离率:=(C-AA30)/AA30*100;
VAR1:=(AA20-AA30)>REF((AA20-AA30),1) AND AA20>REF(AA20,1) AND AA30>REF(AA30,1);
VAR2:=(AA30-AA20)<REF((AA30-AA20),1) AND AA20<REF(AA20,1) AND AA30<REF(AA30,1);
BB30:=ATAN((AA30/REF(AA30,1)-1)*100)*180/3.1416;
加仓:=FILTER(COUNT(CROSS(BB05,30),5)>=1 AND AA05>REF(AA05,1) AND 三拾日乖离率>REF(三拾日乖离率,1) AND AA10>REF(AA10,1)
AND 加速度5>REF(加速度5,1) AND 速度5>REF(速度5,1) ,10) ;
清仓:=FILTER(COUNT(CROSS(30,BB05),5)>=1 AND (C>AA30 OR O>AA30) AND AA05<REF(AA05,1) AND 三拾日乖离率<REF(三拾日乖离率,1) AND AA10<REF(AA10,1),10);
DRAWTEXT(加仓 ,LOW*0.98,'←加'),COLORRED;
JC:=CROSS(0,五日乖离率) AND 三拾日乖离率<REF(三拾日乖离率,1) AND AA10>REF(AA10,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)<AA30;
买入:=FILTER(MR,10);
DRAWTEXT(减仓,HIGH*1.02,'减');
DRAWTEXT(买入,LOW*0.98,'买'),COLORYELLOW;
DRAWTEXT(清仓 ,HIGH*1.02,'清'),COLORGREEN;
A1:=DATE <= 13181231;
工作线:=(EMA(C,14)) * A1;
A2:="cpzb@cp";
STICKLINE((A2 >= 8),H,L,0.8,1),colorgreen;
STICKLINE(((A2 >= 8) AND (C > O)),O,C,8,1),colorgreen;
STICKLINE(((A2 >= 8) AND (C < O)),C,O,8,0),colorgreen;
STICKLINE(((A2 > 0) AND (A2 <= 2)),H,L,0.8,1),colorred;
STICKLINE((((A2 > 0) AND (A2 <= 2)) AND (C > O)),O,C,8,1),colorred;
STICKLINE((((A2 > 0) AND (A2 <= 2)) AND (C < O)),C,O,8,0),colorred;
STICKLINE(((C >= 工作线) AND (C >= O)),H,L,0.5,1),colorred;
STICKLINE(((C >= 工作线) AND (C >= O)),O,C,8,1),colorred;
STICKLINE(((C >= 工作线) AND (C <= O)),H,L,0.5,0),colorred;
STICKLINE(((C >= 工作线) AND (C <= O)),O,C,8,0),colorred;
STICKLINE(((C < 工作线) AND (C >= O)),H,L,0.5,1),colorgreen;
STICKLINE(((C < 工作线) AND (C >= O)),O,C,8,1),colorgreen;
STICKLINE(((C < 工作线) AND (C <= O)),H,L,0.5,0),colorgreen;
STICKLINE(((C < 工作线) AND (C <= O)),O,C,8,0),colorgreen;