DAYCOUNT:=13;
短高H:=(20*H+19*REF(H,1)+18*REF(H,2)+17*REF(H,3)+16*REF(H,4)+15*REF(H,5)+14*REF(H,6)+13*REF(H,7)+12*REF(H,8)+11*REF(H,9)+10*REF(H,10)+9*REF(H,11)+8*REF(H,12)+7*REF(H,13)+6*REF(H,14)+5*REF(H,15)+4*REF(H,16)+3*REF(H,17)+2*REF(H,18)+REF(H,20))/210;
短低L:=(20*L+19*REF(L,1)+18*REF(L,2)+17*REF(L,3)+16*REF(L,4)+15*REF(L,5)+14*REF(L,6)+13*REF(L,7)+12*REF(L,8)+11*REF(L,9)+10*REF(L,10)+9*REF(L,11)+8*REF(L,12)+7*REF(L,13)+6*REF(L,14)+5*REF(L,15)+4*REF(L,16)+3*REF(L,17)+2*REF(L,18)+REF(L,20))/210;
D90H:=EMA(短高H,90)-(EMA(短高H,90)-EMA(短低L,90))*0.2;
D90L:=EMA(短低L,90)+(EMA(短高H,90)-EMA(短低L,90))*0.2;
高0:=(XMA(XMA(H,25),25)-XMA(XMA(L,25),25))*1+XMA(XMA(H,25),25);
低0:=XMA(XMA(L,25),25)-(XMA(XMA(H,25),25)-XMA(XMA(L,25),25))*1;
多头定位:=(高0+低0)/2>(D90H+D90L)/2;空头定位:=(高0+低0)/2<(D90H+D90L)/2;
波段顶0:=(XMA(XMA(H,120),120)-XMA(XMA(L,120),120))*4+XMA(XMA(H,120),120);
波段底0:=XMA(XMA(L,120),120)-(XMA(XMA(H,120),120)-XMA(XMA(L,120),120))*4;
中中中:=((XMA(XMA(H,15),15)+XMA(XMA(H,20),20)+XMA(XMA(H,30),30)+XMA(XMA(H,40),40))/4+(XMA(XMA(L,15),15)+XMA(XMA(L,20),20)+XMA(XMA(L,30),30)+XMA(XMA(L,40),40))/4)/2,LINETHICK0,COLORGREEN;
EMA中中中:=EMA(中中中,10),LINETHICK0,COLORWHITE;A:=(3*C+L+O+H)/6;B:=(20*A+19*REF(A,1)+18*REF(A,2)+17*REF(A,3)+16*REF(A,4)+15*REF(A,5)+14*REF(A,6)+13*REF(A,7)+12*REF(A,8)+11*REF(A,9)+10*REF(A,10)+9*REF(A,11)+8*REF(A,12)+7*REF(A,13)+6*REF(A,14)+5*REF(A,15)+4*REF(A,16)+3*REF(A,17)+2*REF(A,18)+REF(A,20))/210,COLORRED,LINETHICK1;
D:=MA(B,10),COLORRED,LINETHICK1;D14:=MA(B,14),COLORRED,LINETHICK1;D21:=MA(B,21),COLORRED,LINETHICK1;A1:=MA((3*C+L+O+H)/6,28);
B1:=(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,12))/210,COLORGREEN,LINETHICK1;D1:=MA(B1,14),COLORGREEN,LINETHICK1;
中中顶:=(XMA(XMA(H,15),15)+XMA(XMA(H,20),20)+XMA(XMA(H,30),30)+XMA(XMA(H,40),40))/4*2-(XMA(XMA(L,15),15)+XMA(XMA(L,20),20)+XMA(XMA(L,30),30)+XMA(XMA(L,40),40))/4,LINETHICK2,COLORGREEN;中中底:=(XMA(XMA(L,15),15)+XMA(XMA(L,20),20)+XMA(XMA(L,30),30)+XMA(XMA(L,40),40))/4*2-(XMA(XMA(H,15),15)+XMA(XMA(H,20),20)+XMA(XMA(H,30),30)+XMA(XMA(H,40),40))/4,LINETHICK2,COLORGREEN;
短中顶:=(XMA(XMA(H,5),5)+XMA(XMA(H,8),8)+XMA(XMA(H,11),11)+XMA(XMA(H,14),14)+XMA(XMA(H,4),4))/5+((XMA(XMA(H,5),5)+XMA(XMA(H,8),8)+XMA(XMA(H,11),11)+XMA(XMA(H,14),14)+XMA(XMA(H,4),4))/5-(XMA(XMA(L,5),5)+XMA(XMA(L,8),8)+XMA(XMA(L,11),11)+XMA(XMA(L,14),14)+XMA(XMA(L,4),4))/5)/2,LINETHICK0,COLORWHITE;
短中底:=(XMA(XMA(L,5),5)+XMA(XMA(L,8),8)+XMA(XMA(L,11),11)+XMA(XMA(L,14),14))/4-((XMA(XMA(H,5),5)+XMA(XMA(H,8),8)+XMA(XMA(H,11),11)+XMA(XMA(H,14),14)+XMA(XMA(H,4),4))/5-(XMA(XMA(L,5),5)+XMA(XMA(L,8),8)+XMA(XMA(L,11),11)+XMA(XMA(L,14),14)+XMA(XMA(L,4),4))/5)/2,LINETHICK0,COLORWHITE;
中顶:=(XMA(XMA(H,30),30)+XMA(XMA(H,40),40)+XMA(XMA(H,50),50)+XMA(XMA(H,60),60))/4*2.03-(XMA(XMA(L,30),30)+XMA(XMA(L,40),40)+XMA(XMA(L,50),50)+XMA(XMA(L,60),60))/4,LINETHICK2,COLORRED;中底:=(XMA(XMA(L,30),30)+XMA(XMA(L,40),40)+XMA(XMA(L,50),50)+XMA(XMA(L,60),60))/4*1.97-(XMA(XMA(H,30),30)+XMA(XMA(H,40),40)+XMA(XMA(H,50),50)+XMA(XMA(H,60),60))/4,LINETHICK2,COLORRED;
长顶:=(XMA(XMA(H,90),90)+XMA(XMA(H,120),120)+XMA(XMA(H,150),150))/3*2.08-(XMA(XMA(L,90),90)+XMA(XMA(L,120),120)+XMA(XMA(L,150),150))/3,LINETHICK2,COLORYELLOW;长底:=(XMA(XMA(L,90),90)+XMA(XMA(L,120),120)+XMA(XMA(L,150),150))/3*1.92-(XMA(XMA(H,90),90)+XMA(XMA(H,120),120)+XMA(XMA(H,150),150))/3,LINETHICK2,COLORYELLOW;
波段顶:=(XMA(XMA(H,120),120)-XMA(XMA(L,120),120))*4+XMA(XMA(H,120),120);
波段底:=XMA(XMA(L,120),120)-(XMA(XMA(H,120),120)-XMA(XMA(L,120),120))*4;
AF长:=EMA((CLOSE+HIGH+LOW)/3,18);
BF长:=REF(AF长,1);
AF中:=EMA((CLOSE+HIGH+LOW)/3,10);
BF中:=REF(AF中,1);
AF5:=EMA((CLOSE+HIGH+LOW)/3,6);
BF5:=REF(AF5,1);AF3:=EMA((CLOSE+HIGH+LOW)/3,3);
BF3:=REF(AF3,1);
买入定位:=AF长>BF长 OR AF中>BF中 OR AF5>BF5 OR AF3>BF3;
卖出定位:=AF长< BF长 OR AF中< BF中 OR AF5< BF5;顶底定位:=AF长< BF长 OR AF中< BF中 OR AF5< BF5 OR AF3< BF3;
加仓定位1:=卖出定位=1 AND 中中顶>中顶;
加仓定位2:=顶底定位=1 AND H>中中顶 AND H>中顶;
{盘古量趋势}
量:=V;
RSV:=MA(V,7)*1.5;
KK:=SMA(RSV,3,1);
DD:=SMA(KK,3,1);
JJ:=(3*KK-2*DD);
倍量:=(V/REF(V,1)>=1.91 AND COUNT(C> O,1)) OR (L> REF(H,1) AND COUNT(O> C,1) AND V/REF(V,1)>=1.91);
VAR1:=(2*CLOSE+HIGH+LOW)/40;
VAR2:=EXPMA(EXPMA(EXPMA(VAR1,4),4),4);
JJJ:=(VAR2-REF(VAR2,1))/REF(VAR2,1)*100;
DDD:=MA(JJJ,3);
KKK:=MA(JJJ,1);
PW1:=EMA(((VOL*(CLOSE-OPEN)*240/FROMOPEN)/(CLOSE+OPEN)),38);
ME:=EMA(PW1,8)*0.1;
MEE:=ABS(JJJ);
V10:=PEAKBARS(3,15,1)<10;
V12:=IF(V10=1,50,0);
头部:=IF(V12=50,100,0);
TOB:=JJJ<=REF(JJJ,1) OR KKK<=DDD;
卖:=IF(头部> REF(头部,1){ AND TOB},MEE,0);{逃顶}
V9:=TROUGHBARS(3,15,1)<10;
V11:=IF(V9=1,50,0);
底部:=IF(V11=50,50,0);
DINUM:=BARSLAST(底部> REF(底部,1));
DINUM<=DAYCOUNT AND COUNT(头部> REF(头部,1),DINUM)=0
AND (COUNT(中中中>=EMA中中中 AND CROSS(AF中,BF中) AND 短中底<中中底,DINUM)>=1 OR COUNT(中中中>=EMA中中中 AND CROSS(AF中,BF中) AND AF中<中中中 AND AF中<(中顶+中底)/2 AND H<短中顶,DINUM)>=1);
{强烈推荐+买 }
{COUNT(中中中>=EMA中中中 AND CROSS(AF中,BF中) AND 短中底<中中底,7)>=1 OR COUNT(中中中>=EMA中中中 AND CROSS(AF中,BF中) AND AF中<中中中 AND AF中<(中顶+中底)/2 AND H<短中顶,7)>=1;
}
{三条件合并}
{
(中中中>=EMA中中中 AND CROSS(AF中,BF中) AND 短中底<中中底) OR (COUNT(中中中>=EMA中中中 AND CROSS(AF中,BF中) AND AF中<中中中 AND AF中<(中顶+中底)/2 AND H<短中顶,60)>=1 AND
COUNT(加仓定位1=0 AND 加仓定位2=0 AND CROSS(AF中,BF中) AND 中中中>=EMA中中中,60)>=1) OR (COUNT(CROSS((高0+低0)/2,(D90H+D90L)/2),12)>=1);};