参数n:=8
{加权均线 }
A1:=(3*C+H+L+O)/6;
AR2:=(2*A1++REF(A1,2))/3;
AR3:=(3*A1+2*REF(A1,1)+REF(A1,3))/6;
AR5:=(5*A1+4*REF(A1,1)+3*REF(A1,2)+2*REF(A1,3)+REF(A1,5))/15;
AR8:=(8*A1+7*REF(A1,1)+6*REF(A1,2)+5*REF(A1,3)+4*REF(A1,4)+3*REF(A1,5)+2*REF(A1,6)+REF(A1,8))/36;
AR13:=(13*A1+12*REF(A1,1)+11*REF(A1,2)+10*REF(A1,3)+9*REF(A1,4)+8*REF(A1,5)+7*REF(A1,6)+6*REF(A1,7)+5*REF(A1,8)+4*REF(A1,9)+3*REF(A1,10)+2*REF(A1,11)+REF(A1,13))/91;
AR20:=(20*A1+19*REF(A1,1)+18*REF(A1,2)+17*REF(A1,3)+16*REF(A1,4)+15*REF(A1,5)+14*REF(A1,6)+13*REF(A1,7)+12*REF(A1,8)+11*REF(A1,9)+10*REF(A1,10)+9*REF(A1,11)+8*REF(A1,12)+7*REF(A1,13)+6*REF(A1,14)+5*REF(A1,15)+4*REF(A1,16)+3*REF(A1,17)+2*REF(A1,18)+REF(A1,20))/210;
BB:=REF(AR20,1);
VAR6:=(LLV(AR8,2)+LLV(AR8,4)+LLV(AR8,6))/3;
短线:AR8,COLORWHITE,LINETHICK3;
DRAWBAND(AR8,RGB(155,50,50),VAR6,RGB(250,250,0));
STICKLINE(C>=O,C,O,3,0),COLOR0000AA;
STICKLINE(C>=O,C,O,2.5,0),COLOR0000BB;
STICKLINE(C>=O,C,O,2,0),COLOR0000CC;
STICKLINE(C>=O,C,O,1.5,0),COLOR0000DD;
STICKLINE(C>=O,C,O,1,0),COLOR0000EE;
STICKLINE(C>=O,C,O,0.5,0),COLOR0000FF;
STICKLINE(C>=O,H,L,0,0),COLOR0000FF;
STICKLINE(C<O,C,O,3,0),COLORAAAA00;
STICKLINE(C<O,C,O,2.5,0),COLORBBBB00;
STICKLINE(C<O,C,O,2,0),COLORCCCC00;
STICKLINE(C<O,C,O,1.5,0),COLORDDDD00;
STICKLINE(C<O,C,O,1,0),COLOREEEE00;
STICKLINE(C<O,C,O,0.5,0),COLORFFFF00;
STICKLINE(C<O,H,L,0,0),COLORFFFF00;
中线:VAR6,COLORFFAAFF,LINETHICK2;
下跌:IF(AR8=VAR6,VAR6, DRAWNULL),COLORGREEN,LINETHICK3;
多C:IF(AR8>=BB,AR8,BB),COLOREE00EE,LINETHICK1;
多C1:IF(AR3>=BB,AR3,BB),COLORFFFFFF,LINETHICK1;
多C2:IF(AR5>=BB,AR5,BB),COLOR00FFFF,LINETHICK1;
多C3:IF(AR13>=BB,AR13,BB),COLOR00FF00,LINETHICK1;
多C4:IF(AR20>=BB,AR20,BB),COLOR0000FF,LINETHICK1;
空C2:IF(BB-AR20,BB,AR20),COLOR00FF00,LINETHICK2;
D11:IF(AR3<REF(AR3,1) AND AR3>BB,AR3,DRAWNULL),LINETHICK2,COLORFF0000;
D2:IF(AR5<REF(AR5,1) AND AR5>BB,AR5,DRAWNULL),LINETHICK2,COLORFF0000;
D3:IF(AR13<REF(AR13,1) AND AR13>BB,AR13,DRAWNULL),LINETHICK2,COLORFF0000;
D4:IF(AR8<REF(AR8,1) AND AR8>BB,AR8,DRAWNULL),LINETHICK2,COLORFF0000;
IF(BB>REF(BB,1),BB,DRAWNULL),LINETHICK2,COLOR00FFFF;
VAR1111:=BACKSET(REF(HIGH,2)=HHV(HIGH,5),3);
VAR2222:=CROSS(VAR1111,0.9);
VAR3333:=BACKSET(REF(LOW,2)=LLV(LOW,5),3);
VAR4444:=CROSS(VAR3333,0.9);
压力:= REF(HIGH,BARSLAST(VAR2222));
STICKLINE(CLOSE,REF(HIGH,BARSLAST(VAR2222)),REF(HIGH,BARSLAST(VAR2222)),0.5,1),COLOREA91B5,LINETHICK3;
支撑:= REF(LOW,BARSLAST(VAR4444));
STICKLINE(CLOSE,REF(LOW,BARSLAST(VAR4444)),REF(LOW,BARSLAST(VAR4444)),0.5,1),COLOR00B4FF,LINETHICK3;
AA05:=MA(C,5),COLOR0099CC;
五日乖离率:=(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),NODRAW;
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;
VAR11:=(AA20-AA30)>REF((AA20-AA30),1)
AND AA20>REF(AA20,1) AND AA30>REF(AA30,1);
VAR22:=(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(BB30>30 AND BB10>45 AND
CROSS(BB05,60),10);
加仓:=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);
DRAWICON(加仓 ,LOW*0.99,23);
DRAWICON(清仓 ,HIGH*1.01,15);
DRAWICON(强势狙击 ,LOW*0.99,13);
TYP := (HIGH + LOW + CLOSE)/3;
CCI1:=(TYP-MA(TYP,6))/(0.015*AVEDEV(TYP,6));
差值1:=ABS(REF(CCI1,1)-CCI1),LINETHICK0;
CCI2:=(TYP-MA(TYP,10))/(0.015*AVEDEV(TYP,10));
差值2:=ABS(REF(CCI2,1)-CCI2),LINETHICK0;
CCI3:=(TYP-MA(TYP,20))/(0.015*AVEDEV(TYP,20));
差值3:=ABS(REF(CCI3,1)-CCI3),LINETHICK0;
CCI4:=(TYP-MA(TYP,30))/(0.015*AVEDEV(TYP,30));
差值4:=ABS(REF(CCI4,1)-CCI4),LINETHICK0;
CCI5:=(TYP-MA(TYP,60))/(0.015*AVEDEV(TYP,60));
差值5:=ABS(REF(CCI5,1)-CCI5),LINETHICK0;
CCI:=CCI1+CCI2+CCI3+CCI4+CCI5;
TJ1:= CCI1>差值4;
立桩量:=FILTER(TJ1,0);
TJ2:=IF(BARSLAST(立桩量)=1 ,1,IF(BARSLAST(立桩量)=2 ,1,
IF(BARSLAST(立桩量)=3 ,1,0)));
成立1:=TJ2;
条件成立1:=FILTER(成立1,5);
TJ11:= CCI1<-差值4 ;
立桩量2:=FILTER(TJ11,0);
TJ22:=IF(BARSLAST(立桩量2)=1 AND CLOSE>REF(HIGH,1),1,
IF(BARSLAST(立桩量2)=2 AND CLOSE>REF(HIGH,2),1,
IF(BARSLAST(立桩量2)=3 AND CLOSE>REF(HIGH,3),1,0)));
成立2:=TJ22;
条件成立2:=FILTER(成立2,5);
TJ111:=(ABS(CCI1)>CCI AND ABS( 差值1)> ABS(差值5))
OR (VOL=HHV(VOL,10) AND VOL>2*REF(VOL,1) AND CLOSE>AR8);
立桩量3:=FILTER(TJ111,5);
TJ222:=IF(BARSLAST(立桩量3)=1 AND CLOSE>REF(HIGH,1),1,IF(BARSLAST(立桩量3)=2 AND CLOSE>REF(HIGH,2),1,IF(BARSLAST(立桩量3)=3 AND CLOSE>REF(HIGH,3),1,0)));
突破3:=TJ222=1;
STICKLINE(CLOSE AND 下跌!= VAR6,REF(HIGH,BARSLAST(立桩量3)),
REF(HIGH,BARSLAST(立桩量3)),10,1),COLORCYAN;
STICKLINE(CLOSE AND 下跌!= VAR6,REF(LOW,BARSLAST(立桩量3)),
REF(LOW,BARSLAST(立桩量3)),10,1),COLORYELLOW;
TJ3:=IF(BARSLAST(立桩量3)=1 AND CLOSE>REF(LOW,1),1,IF(BARSLAST(立桩量3)=2 AND CLOSE>REF(LOW,2),1,IF(BARSLAST(立桩量3)=3 AND CLOSE>REF(LOW,3),1,0)));
三天法则:=TJ3=1;
成立:=三天法则 AND 突破3;
条件成立:=FILTER(成立,5);
TJ31:=(VOL=HHV(VOL,10) AND VOL>2*REF(VOL,1) AND CLOSE>AR8);
TJ32:=FILTER(TJ31,1);
IF(条件成立 AND 下跌!= VAR6 AND AA30>=REF(AA30,1),H*1.03,DRAWNULL),CROSSDOT,LINETHICK6,COLORFF33FF;
IF(条件成立 AND 下跌!= VAR6 AND AA30>=REF(AA30,1),H*1.03,DRAWNULL),POINTDOT,LINETHICK4,COLOR00CCFF;
DRAWICON(条件成立1,REF(HIGH,BARSLAST(立桩量3)),12);
DRAWICON(条件成立2,REF(LOW,BARSLAST(立桩量3)),11);
DRAWICON(CROSS(AR8,BB),BB,9);
DRAWICON(CROSS(AR5,中线),中线,6);
TT4:=(CURRBARSCOUNT=26+1);
DRAWTEXT(TT4,LLV(L,20), '迷惑创于09.05.16'),LINETHICK1,COLORCYAN;
{以下部分可以去掉}
M:=INTPART(3*N/5);
E1:=REF(H,N)=HHV(H,2*N+1);
F1:=BACKSET(E1,N+1);
G1:=FILTER(F1,N) AND H=HHV(H,N+1);
DRAWICON(G1,H*1.01,2);
E2:=REF(H,M)=HHV(H,2*M+1);
F2:=BACKSET(E2,M+1);
G2:=FILTER(F2,M) AND H=HHV(H,M+1);
DRAWICON(G2,H*1.01,2);
EE1:=REF(L,N)=LLV(L,2*N+1);
FF1:=BACKSET(EE1,N+1);
GG1:=FILTER(FF1,N) AND L=LLV(L,N+1);
DRAWICON(GG1,L*0.987,1);
EE2:=REF(L,M)=LLV(L,2*M+1);
FF2:=BACKSET(EE2,M+1);
GG2:=FILTER(FF2,M) AND L=LLV(L,M+1);
DRAWICON(GG2,L*0.987,1);
|