P0:=SMA(INDEXC,34,1);
P1:=(55*P0+34*REF(P0,1)+21*REF(P0,2)+13*REF(P0,3)+8*REF(P0,4)+5*REF(P0,5)
+3*REF(P0,6)+2*REF(P0,7)+REF(P0,8)+REF(P0,9))/143;
P2:=REF(P1,1);
大盘长牛熊:=0.5*(P1+P2);
A0:SMA(C,3,1),COLORWHITE;
A1:=(55*A0+34*REF(A0,1)+21*REF(A0,2)+13*REF(A0,3)+8*REF(A0,4)+5*REF(A0,5)
+3*REF(A0,6)+2*REF(A0,7)+REF(A0,8)+REF(A0,9))/143;
A2:=REF(A1,1);
超短牛熊:0.5*(A1+A2),COLORRED;
ZD0:=SMA(C,5,1),COLORRED;
ZD1:=(55*ZD0+34*REF(ZD0,1)+21*REF(ZD0,2)+13*REF(ZD0,3)+8*REF(ZD0,4)+5*REF(ZD0,5)
+3*REF(ZD0,6)+2*REF(ZD0,7)+REF(ZD0,8)+REF(ZD0,9))/143;
ZD2:=REF(ZD1,1);
中短牛熊:0.5*(ZD1+ZD2),COLORYELLOW;
H0:=SMA(C,8,1);
H1:=(55*H0+34*REF(H0,1)+21*REF(H0,2)+13*REF(H0,3)+8*REF(H0,4)+5*REF(H0,5)
+3*REF(H0,6)+2*REF(H0,7)+REF(H0,8)+REF(H0,9))/143;
H2:=REF(H1,1);
短期牛熊:0.5*(H1+H2),COLORMAGENTA;
{DRAWBAND(H1,RGB(255,255,0),H2,RGB(0,0,255));
STICKLINE(H1>H2,H1,H2,10,0),COLORYELLOW;}
DZ0:=SMA(C,13,1);
DZ1:=(55*DZ0+34*REF(DZ0,1)+21*REF(DZ0,2)+13*REF(DZ0,3)+8*REF(DZ0,4)+5*REF(DZ0,5)
+3*REF(DZ0,6)+2*REF(DZ0,7)+REF(DZ0,8)+REF(DZ0,9))/143;
DZ2:=REF(DZ1,1);
短中牛熊:0.5*(DZ1+DZ2),COLORWHITE;
ZX0:=SMA(C,21,1);
ZX1:=(55*ZX0+34*REF(ZX0,1)+21*REF(ZX0,2)+13*REF(ZX0,3)+8*REF(ZX0,4)+5*REF(ZX0,5)
+3*REF(ZX0,6)+2*REF(ZX0,7)+REF(ZX0,8)+REF(ZX0,9))/143;
ZX2:=REF(ZX1,1);
中线牛熊:=0.5*(ZX1+ZX2),COLORGREEN;
I0:=SMA(C,34,1);
I1:=(55*I0+34*REF(I0,1)+21*REF(I0,2)+13*REF(I0,3)+8*REF(I0,4)+5*REF(I0,5)
+3*REF(I0,6)+2*REF(I0,7)+REF(I0,8)+REF(I0,9))/143;
I2:=REF(I1,1);
中长牛熊:0.5*(I1+I2),COLORCYAN;
CX0:=SMA(C,55,1);
CX1:=(55*CX0+34*REF(CX0,1)+21*REF(CX0,2)+13*REF(CX0,3)+8*REF(CX0,4)+5*REF(CX0,5)
+3*REF(CX0,6)+2*REF(CX0,7)+REF(CX0,8)+REF(CX0,9))/143;
CX2:=REF(CX1,1);
长线牛熊:0.5*(CX1+CX2),COLORBLUE;
CC0:=SMA(C,89,1);
CC1:=(55*CC0+34*REF(CC0,1)+21*REF(CC0,2)+13*REF(CC0,3)+8*REF(CC0,4)+5*REF(CC0,5)
+3*REF(CC0,6)+2*REF(CC0,7)+REF(CC0,8)+REF(CC0,9))/143;
CC2:=REF(CC1,1);
超长牛熊:0.5*(CC1+CC2),COLORGREEN,LINETHICK2;
TC0:=SMA(C,144,1);
TC1:=(55*TC0+34*REF(TC0,1)+21*REF(TC0,2)+13*REF(TC0,3)+8*REF(TC0,4)+5*REF(TC0,5)
+3*REF(TC0,6)+2*REF(TC0,7)+REF(TC0,8)+REF(TC0,9))/143;
TC2:=REF(TC1,1);
特长牛熊:0.5*(TC1+TC2),COLORMAGENTA,LINETHICK2;
SC0:=SMA(C,233,1);
SC1:=(55*SC0+34*REF(SC0,1)+21*REF(SC0,2)+13*REF(SC0,3)+8*REF(SC0,4)+5*REF(SC0,5)
+3*REF(SC0,6)+2*REF(SC0,7)+REF(SC0,8)+REF(SC0,9))/143;
SC2:=REF(SC1,1);
特牛熊:0.5*(SC1+SC2),COLORMAGENTA,LINETHICK2;
{DRAWBAND(I1,RGB(255,0,0),I2,RGB(0,255,0));
STICKLINE(I1>I2,I1,I2,10,0),COLORRED;}
{差:100*(短期牛熊-长期牛熊)/长期牛熊,COLORMAGENTA,NODRAW;};
{笔底分型 选股 预警 确保向下笔成立后的底分型}
V00:= HIGH<REF(HIGH,1) AND LOW<REF(LOW,1);
V01:= HIGH<REF(HIGH,1) AND LOW>REF(LOW,1);
V02:= HIGH>REF(HIGH,1) AND LOW<REF(LOW,1);
V03:= HIGH>REF(HIGH,1) AND LOW>REF(LOW,1);
V04:= REF(HIGH,2) < HIGH AND REF(LOW,2) < LOW
AND REF(HIGH,2) > REF(HIGH,1) AND REF(LOW,2) < REF(LOW,1);
V1:= COUNT(V00,6)>=3 AND COUNT(V01 OR V02,5)=0 AND LLVBARS(LOW,6) = 1 AND HHVBARS(HIGH,6) >= 5 AND V03;
V2:= COUNT(V00,7)>=3 AND COUNT(V01 OR V02,6)=1 AND LLVBARS(LOW,7) = 2 AND HHVBARS(HIGH,7) >= 6 AND V04;
V3:= COUNT(V00,7)>=3 AND COUNT(V01 OR V02,6)=1 AND LLVBARS(LOW,7) = 1 AND HHVBARS(HIGH,7) >= 6 AND V03;
V4:= COUNT(V00,8)>=3 AND COUNT(V01 OR V02,7)<=2 AND LLVBARS(LOW,8) = 2 AND HHVBARS(HIGH,8) >= 7 AND V04;
V5:= COUNT(V00,8)>=3 AND COUNT(V01 OR V02,7)<=2 AND LLVBARS(LOW,8) = 1 AND HHVBARS(HIGH,8) >= 7 AND V03;
V6:= COUNT(V00,9)>=3 AND COUNT(V01 OR V02,8)<=3 AND LLVBARS(LOW,9) = 2 AND HHVBARS(HIGH,9) >= 8 AND V04;
V7:= COUNT(V00,9)>=3 AND COUNT(V01 OR V02,8)<=3 AND LLVBARS(LOW,9) = 1 AND HHVBARS(HIGH,9) >= 8 AND V03;
V8:= COUNT(V00,10)>=3 AND COUNT(V01 OR V02,9)<=4 AND LLVBARS(LOW,10) = 2 AND HHVBARS(HIGH,10) >= 9 AND V04;
V9:= COUNT(V00,10)>=3 AND COUNT(V01 OR V02,9)<=4 AND LLVBARS(LOW,10) = 1 AND HHVBARS(HIGH,10) >= 9 AND V03;
V10:= COUNT(V00,11)>=3 AND COUNT(V01 OR V02,10)<=5 AND LLVBARS(LOW,11) = 2 AND HHVBARS(HIGH,11) >= 10 AND V04;
XG:= V1 OR V2 OR V3 OR V4 OR V5 OR V6 OR V7 OR V8 OR V9 OR V10;
DRAWTEXT(FILTER(XG=1,5),L*0.998,'底'),COLORYELLOW;
{笔顶分型 选股 预警 确保向上笔成立后的顶分型}
HV00:= HIGH>REF(HIGH,1) AND LOW>REF(LOW,1);
HV01:= HIGH<REF(HIGH,1) AND LOW>REF(LOW,1);
HV02:= HIGH>REF(HIGH,1) AND LOW<REF(LOW,1);
HV03:= HIGH<REF(HIGH,1) AND LOW<REF(LOW,1);
HV04:= REF(HIGH,2) > HIGH AND REF(LOW,2) > LOW AND REF(HIGH,2) > REF(HIGH,1) AND REF(LOW,2) < REF(LOW,1);
{ 爱约股_通达信股票指标公式}
HV1:= COUNT(HV00,6)>=3 AND COUNT(HV01 OR HV02,5)=0 AND HHVBARS(HIGH,6) = 1 AND LLVBARS(LOW,6) >= 5 AND HV03;
HV2:= COUNT(HV00,7)>=3 AND COUNT(HV01 OR HV02,6)=1 AND HHVBARS(HIGH,7) = 2 AND LLVBARS(LOW,7) >= 6 AND HV04;
HV3:= COUNT(HV00,7)>=3 AND COUNT(HV01 OR HV02,6)=1 AND HHVBARS(HIGH,7) = 1 AND LLVBARS(LOW,7) >= 6 AND HV03;
HV4:= COUNT(HV00,8)>=3 AND COUNT(HV01 OR HV02,7)<=2 AND HHVBARS(HIGH,8) = 2 AND LLVBARS(LOW,8) >= 7 AND HV04;
HV5:= COUNT(HV00,8)>=3 AND COUNT(HV01 OR HV02,7)<=2 AND HHVBARS(HIGH,8) = 1 AND LLVBARS(LOW,8) >= 7 AND HV03;
HV6:= COUNT(HV00,9)>=3 AND COUNT(HV01 OR HV02,8)<=3 AND HHVBARS(HIGH,9) = 2 AND LLVBARS(LOW,9) >= 8 AND HV04;
HV7:= COUNT(HV00,9)>=3 AND COUNT(HV01 OR HV02,8)<=3 AND HHVBARS(HIGH,9) = 1 AND LLVBARS(LOW,9) >= 8 AND HV03;
HV8:= COUNT(HV00,10)>=3 AND COUNT(HV01 OR HV02,9)<=4 AND HHVBARS(HIGH,10) = 2 AND LLVBARS(LOW,10) >= 9 AND HV04;
HV9:= COUNT(HV00,10)>=3 AND COUNT(HV01 OR HV02,9)<=4 AND HHVBARS(HIGH,10) = 1 AND LLVBARS(LOW,10) >= 9 AND HV03;
HV10:= COUNT(HV00,11)>=3 AND COUNT(HV01 OR HV02,10)<=5 AND HHVBARS(HIGH,11) = 2 AND LLVBARS(LOW,11) >= 10 AND HV04;
HXG:=HV1 OR HV2 OR HV3 OR HV4 OR HV5 OR HV6 OR HV7 OR HV8 OR HV9 OR HV10;
{DRAWTEXT(FILTER(HXG=1,3),H*1.01,'顶'),COLORGREEN;};