通达信股票结构指标公式
N:=10;
VAR3:=EMA(C,15*N);
VAR4:=REF(VAR3,1);
市场价格流转:0-(SUM(VAR3<VAR4,0)-SUM(VAR3>VAR4,0)),COLORLIBLUE,DOTLINE;
市场价格:IF(市场价格流转>REF(市场价格流转,1),市场价格流转,DRAWNULL),COLORLIRED;
{NA:=15;
VAR3A:=EMA(C,15*NA);
VAR4A:=REF(VAR3A,1);
市场价格流转A:=(0-(SUM(VAR3A<VAR4A,0)-SUM(VAR3A>VAR4A,0))),COLORLIBLUE,DOTLINE;
市场价格A:IF(市场价格流转A>REF(市场价格流转A,1),LLV(市场价格流转A,5*NA),DRAWNULL),COLORRED;
市场价格B:IF(市场价格流转A>REF(市场价格流转A,1),DRAWNULL,HHV(市场价格流转A,5*NA)),COLORGREEN;}
U1:=BARSLAST(REF(CROSS(VAR3,VAR4),1));
U2:=REF(C,U1)>C ;
D1:=BARSLAST(REF(CROSS(VAR4,VAR3),1));
D2:=REF(C,D1)<C ;
BDGD:=D1=HHV(D1,5);
GDSJ:=BARSLAST(FILTER(CROSS(0.8,BDGD),2))+1;
BDDD:=U1=LLV(U1,5);
DDSJ:=BARSLAST(FILTER(CROSS(0.8,BDDD),2))+1;
BD:=市场价格流转=HHV(市场价格流转,BARSLAST(DDSJ>=GDSJ));
GD:=BARSLAST(FILTER(CROSS(BD,0.8),2));
底背离:=IF(U2>0,1,0);
低点:REF(LLV(市场价格流转,BARSLAST(DDSJ>=GDSJ)+1),GD),COLORGRAY,DOTLINE;
AB:=REF(LLV(市场价格流转,BARSLAST(DDSJ>=GDSJ)+1),底背离),COLORLIBLUE;
DD:=市场价格流转=LLV(市场价格流转,BARSLAST(GDSJ>=DDSJ));
SJ:=BARSLAST(FILTER(CROSS(DD,0.8),2));
顶背离:=IF(D2>0,1,0);
高点:REF(HHV(市场价格流转,BARSLAST(DDSJ<=GDSJ)+1),SJ),COLORGRAY,DOTLINE;
AA:=REF(HHV(市场价格流转,BARSLAST(DDSJ<=GDSJ)+1),顶背离),COLORLIRED;
高:IF(高点=AA,DRAWNULL,AA),COLORLIRED;
低:IF(低点=AB,DRAWNULL,AB),COLORLIBLUE;
真正顶背离:IF(NOT(高点=AA) AND AA>高点,高点,DRAWNULL),COLORLIMAGENTA,LINETHICK3;
真正底背离:IF(NOT(低点=AB) AND AB<低点,低点,DRAWNULL),COLORBLUE,LINETHICK3;
STICKLINE(低>市场价格流转,低,市场价格流转,1,0),COLORGREEN;
STICKLINE(高<市场价格流转,高,市场价格流转,1,0),COLORRED;
{笔底分型 选股 预警 确保向下笔成立后的底分型}
V00:= HIGH<REF(HIGH,12/3) AND LOW<REF(LOW,12/3);
V01:= HIGH<REF(HIGH,12/3) AND LOW>REF(LOW,12/3);
V02:= HIGH>REF(HIGH,12/3) AND LOW<REF(LOW,12/3);
V03:= HIGH>REF(HIGH,12/3) AND LOW>REF(LOW,12/3);
V04:= REF(HIGH,21/3) < HIGH AND REF(LOW,21/3) < LOW AND REF(HIGH,21/3) > REF(HIGH,12/3) AND REF(LOW,21/3) < REF(LOW,12/3);
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,12/3) AND LOW>REF(LOW,12/3);
HV01:= HIGH<REF(HIGH,12/3) AND LOW>REF(LOW,12/3);
HV02:= HIGH>REF(HIGH,12/3) AND LOW<REF(LOW,12/3);
HV03:= HIGH<REF(HIGH,12/3) AND LOW<REF(LOW,12/3);
HV04:= REF(HIGH,21/3) > HIGH AND REF(LOW,21/3) > LOW AND REF(HIGH,21/3) > REF(HIGH,12/3) AND REF(LOW,21/3) < REF(LOW,12/3);
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;}
DRAWTEXT(FILTER(XG=1,5) AND 高<市场价格流转,市场价格流转-40,'底型'),COLORGREEN,LINETHICK1;
DRAWTEXT(FILTER(HXG=1,5) AND 低>市场价格流转,市场价格流转+40,'顶型'),COLORRED,LINETHICK1;