以下是通达信突破划线指标公式

DRAWGBK(C>0, RGB(40,120,20),RGB(00,00,00),0,0,1),LINETHICK2;
 {箱体 }
 N:=13;
 BC:=(H*0.382+L*0.618+O*0.382+C*0.618)/2;
 LJ:=IF(INDEXC=C,BC,(BC+AMOUNT/(V*100))/2),COLORGRAY;
 HT:=REF((HHV(LJ,N*0.691)+HHV(LJ,N)+HHV(LJ,N*1.309))/3,1),LINETHICK,COLORRED;
 LT:=REF((LLV(LJ,N*0.691)+LLV(LJ,N)+LLV(LJ,N*1.309))/3,1),LINETHICK,COLORGREEN;
 ZT:=(HT+LT)/2,LINETHICK,COLORYELLOW;
 STICKLINE(ISLASTBAR=1  AND LJ<ZT,HT,LT,N*8,0),COLORBLUE;
 STICKLINE(ISLASTBAR=1  AND LJ=ZT,HT,LT,N*8,0),COLORGRAY;
STICKLINE(ISLASTBAR=1  AND LJ>ZT,HT,LT,N*8,1),COLORWHITE;
 STICKLINE(ISLASTBAR=1,ZT,ZT,N*8,0),COLORWHITE;
 箱顶:HT,COLORWHITE,NODRAW;
 箱中:ZT,COLORWHITE,NODRAW;
 DRAWKLINE(H,O,L,C);
 

{短期支撑压力线}
 N1:=5;
 A1:=REF(H,N1)=HHV(H,2*N1+1);
 B1:=FILTER(A1,N1);
 C1:=BACKSET(B1,N1+1);
 D1:=FILTER(C1,N1);
 A2:=REF(L,N1)=LLV(L,2*N1+1);
 B2:=FILTER(A2,N1);
 C2:=BACKSET(B2,N1+1);
 D2:=FILTER(C2,N1);
 E1:=(REF(LLV(L,2*N1),1)+REF(HHV(H,2*N1),1))/2;
 E2:=(H+L)/2;
 H1:=(D1 AND NOT(D2 AND E1>=E2)) OR ISLASTBAR OR BARSCOUNT(C)=1;
 L1:=(D2 AND NOT(D1 AND E1<E2));
 H2:=D1 AND NOT(D2 AND E1>=E2);
 X1:=REF(BARSLAST(H1),1)+1;
 F1:=BACKSET(H1 AND COUNT(L1,X1)>0,LLVBARS(IF(L1,L,10000),X1));
 G1:=F1>REF(F1,1);
 I1:=BACKSET(G1,2);
 LD:=I1>REF(I1,1);
 L2:=LD OR ISLASTBAR OR BARSCOUNT(C)=1;
 X2:=REF(BARSLAST(L2),1)+1;
 F2:=BACKSET(L2 AND COUNT(H2,X2)>0,HHVBARS(IF(H2,H,0),X2));
 G2:=F2>REF(F2,1);
 I2:=BACKSET(G2,2);
 HD:=I2>REF(I2,1);
 R1:=BACKSET(ISLASTBAR,BARSLAST(HD)+1);
 S1:=R1>REF(R1,1);
 T1:=BACKSET(ISLASTBAR,BARSLAST(LD)+1);
 U1:=T1>REF(T1,1);
 R2:=BACKSET(S1,REF(BARSLAST(HD),1)+2);
 S2:=R2>REF(R2,1);
 T2:=BACKSET(U1,REF(BARSLAST(LD),1)+2);
 U2:=T2>REF(T2,1);
 短压力线:DRAWLINE(S2,H,S1,H,1),COLORGREEN,LINETHICK2;
 短支撑线:DRAWLINE(U2,L,U1,L,1),COLORRED,LINETHICK2;
 降△边:DRAWLINE(HIGH>=HHV(HIGH,10),HIGH,LOW<=LLV(LOW,3),HHV(HIGH,3),1),COLORCYAN,DOTLINE;
 涨△边:DRAWLINE(LOW<=LLV(LOW,10),LOW,HIGH>=HHV(HIGH,3),LLV(LOW,3),1),COLORCYAN,DOTLINE;
 

{中期趋势回归划线}
 
UR:=6;
 LR:=UR;
 TC1:=IF(H=HHV(H,8*UR),H,DRAWNULL);
 TC2:=CONST(BARSLAST(TC1=H))+1;
 UPPER:=CONST(IF(TC2=1,H,REF(H,TC2-1)));
 BC1:=IF(L=LLV(L,8*LR),L,DRAWNULL);
 BC2:=CONST(BARSLAST(BC1=L))+1;
 LOWER:=CONST(IF(BC2=1,L,REF(L,BC2-1)));
 LP:=CURRBARSCOUNT<=BC2 AND L=LOWER;{低点定位}
 HP:=CURRBARSCOUNT<=TC2 AND H=UPPER;{高点定位}
 STICKLINE(IF(BC2>TC2,HP,LP),LOWER,UPPER,0,0),COLOR628962;
 STICKLINE(IF(BC2>TC2,LP,HP),LOWER,UPPER,0,0),COLOR628962;
 NOD:=(IF(TC2>BC2,TC2,BC2)-IF(TC2>BC2,BC2,TC2));{用时}
 LR1:=FORCAST(C,NOD+1);
 NP:IF(CURRBARSCOUNT<=MAX(BC2,TC2),CONST(IF(MIN(TC2,BC2)=1,LR1,REF(LR1,MIN(TC2,BC2)-1))),DRAWNULL),POINTDOT,COLOR93BDA8;{近点}
 LR2:=SLOPE(C,NOD+1);
 LR3:=CONST(IF(MIN(TC2,BC2)=1,LR2,REF(LR2,MIN(TC2,BC2)-1)));
 FP:NP-LR3*(NOD),POINTDOT,COLOR93BDA8;{远点}
 EQU:(NP+FP)/2,POINTDOT,COLOR93BDA8;
 AD:=ABS(NP-FP);{高差};
 DBL:=BARSLAST(BC1!=DRAWNULL)+1;
 DBH:=BARSLAST(TC1!=DRAWNULL)+1;
 BSP:=IF(BC2>TC2,DBL,DBH)-1;
 LRL:=IF(NP>FP,FP+AD/NOD*BSP,FP-AD/NOD*BSP);
 AT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND H>LRL,H,LRL);
 AT2:=HHV(AT1-LRL,MAX(BC2,TC2));
 AT3:=CONST(BARSLAST(AT1-LRL=AT2));
 AT4:=CONST(IF(AT3=0,H,REF(H,AT3)));
 AT5:=CONST(IF(AT3=0,AT1-LRL,REF(AT1-LRL,AT3)));
 ATL:=LRL+AT5;
 UT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND L<LRL,L,LRL);
 UT2:=HHV(LRL-UT1,MAX(BC2,TC2));
 UT3:=CONST(BARSLAST(LRL-UT1=UT2));
 UT4:=CONST(IF(UT3=0,H,REF(H,UT3)));
 UT5:=CONST(IF(UT3=0,LRL-UT1,REF(LRL-UT1,UT3)));
 UTL:=LRL-UT5;
 RH:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-10,ATL,CONST(REF(ATL,MIN(BC2,TC2)-11)));{限制高}
 RL:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-10,UTL,CONST(REF(UTL,MIN(BC2,TC2)-11)));{限制低}
 中期中轨:IF(NP>FP,IF(LRL<=RH,LRL,DRAWNULL),IF(LRL>=RL,LRL,DRAWNULL)),COLOR628962,LINETHICK2;
 中期上轨:IF(NP>FP,IF(ATL<=RH,ATL,DRAWNULL),IF(ATL>=RL,ATL,DRAWNULL)),COLOR628962,LINETHICK2;
 中期下轨:IF(NP>FP,IF(UTL<=RH,UTL,DRAWNULL),IF(UTL>=RL,UTL,DRAWNULL)),,COLOR628962,LINETHICK2;
 
{彩色K线}
 TYX3:=MA(REF(HHV((C+L+O+H)/4,30),1),3);
 TYX4:=MA((C+L+O+H)/4,13);
 TYX5:=EMA((C+L+O+H)/4,21);
 {空心红}
 STICKLINE(C<TYX5 AND C>O,H,L,0,0),COLORRED;
 STICKLINE(C<TYX5 AND C>O,C,O,3,1),COLORRED;
 {深绿}
 STICKLINE(C<TYX5 AND C<O,H,L,0,0),COLOR00AA00;
 STICKLINE(C<TYX5 AND C<O,C,O,3,0),COLOR00BB00;
 STICKLINE(C<TYX5 AND C<O,C,O,2,0),COLOR00DD00;
 STICKLINE(C<TYX5 AND C<O,C,O,1,0),COLOR00FF00;
 
{蓝}
 STICKLINE(C>TYX5 AND C<O,H,L,0,0),COLORFFDD44;
 STICKLINE(C>TYX5 AND C<O,C,O,3,0 ),COLORFF7700;
 STICKLINE(C>TYX5 AND C<O,C,O,2,0 ),COLORFFAA22;
 STICKLINE(C>TYX5 AND C<O,C,O,1 ,0 ),COLORFFDD44;
 {黄}
 STICKLINE(C>TYX5 AND C>O,H,L,0,0 ),COLOR00EEFF;
 STICKLINE(C>TYX5 AND C>O,C,O,3,0 ),COLOR00AAFF;
 STICKLINE(C>TYX5 AND C>O,C,O,2,0 ),COLOR00CCFF;
 STICKLINE(C>TYX5 AND C>O,C,O,1,0 ),COLOR00EEFF;
 {粉红}
 STICKLINE(C>TYX4 AND C>O,H,L,0,0),COLORFF66AA;
 STICKLINE(C>TYX4 AND C>O,C,O,3,0 ),COLORFF11FF;
 STICKLINE(C>TYX4 AND C>O,C,O,2,0 ),COLORFF44FF;
 STICKLINE(C>TYX4 AND C>O,C,O,1,0 ),COLORFF66FF;
 {亮灰}
 STICKLINE(C>TYX4 AND C<O,H,L,0,0),COLOR999999;
 STICKLINE(C>TYX4 AND C<O,C,O,3,0),COLOR555555;
 STICKLINE(C>TYX4 AND C<O,C,O,2,0),COLOR777777;
 STICKLINE(C>TYX4 AND C<O,C,O,1,0),COLOR999999;
 {深红}
 STICKLINE(C>TYX3 AND C>O,H,L,0,0),COLOR0000DD;
 STICKLINE(C>TYX3 AND C>O,C,O,3,0),COLOR000099;
 STICKLINE(C>TYX3 AND C>O,C,O,2,0),COLOR0000BB;
 STICKLINE(C>TYX3 AND C>O,C,O,1,0),COLOR0000DD;
 {涨跌停K线}
 STICKLINE((C-REF(C,1))*100/REF(C,1)>=(10-0.01*100/REF(C,1)),OPEN,CLOSE,1,0),COLORYELLOW;
 STICKLINE((REF(C,1)-C)*100/REF(C,1)>=(10-0.01*100/REF(C,1)),OPEN,CLOSE,1,0),COLORWHITE;
 {突破}
 STICKLINE(REF(COUNT(C<TYX3,5)=5,1) AND C>TYX3 AND C>O,C,O,1,0),COLOR00CCFF;
 {红绿三角【副图】}
 A10304:=REF(HIGH,3)=HHV(HIGH,2*3+1);
B10304:=FILTER(A10304,3);
C10304:=BACKSET(B10304,3+1);
D10304:=FILTER(C10304,3);{高点}
 A20304:=REF(LOW,3)=LLV(LOW,2*3+1);
B20304:=FILTER(A20304,3);
C20304:=BACKSET(B20304,3+1);
D20304:=FILTER(C20304,3);{低点}
 E10304:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2;
E20304:=(HIGH+LOW)/2;{高低点出现在同一K线上时可作取舍}
 H10304:=(D10304 AND NOT(D20304 AND E10304>=E20304)) OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
 L10304:=(D20304 AND NOT(D10304 AND E10304=E20304));
 X10304:=REF(BARSLAST(H10304),1)+1;
F10304:=BACKSET(H10304 AND COUNT(L10304,X10304)>0,LLVBARS(IF(L10304,LOW,10000),X10304));
 G10304:=F10304>REF(F10304,1);
I10304:=BACKSET(G10304,2);
LD0304:=I10304>REF(I10304,1);{过滤后低点}
 L20304:=LD0304 OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
 X20304:=REF(BARSLAST(L20304),1)+1;
F20304:=BACKSET(L20304 AND COUNT(H10304,X20304)>0,HHVBARS(IF(H10304,HIGH,0),X20304));
 G20304:=F20304>REF(F20304,1);
I20304:=BACKSET(G20304,2);
HD0304:=I20304>REF(I20304,1);{过滤后高点}
 UU0304:=BACKSET(BARSTATUS=2,BARSLAST(LD0304)+1);
 VV0304:=UU0304>REF(UU0304,1);
 UU20304:=BACKSET(BARSTATUS=2,BARSLAST(HD0304)+1);
 VV20304:=UU20304>REF(UU20304,1);
 
{以下语句为三角形部分}
 底:REF(L,BARSLAST(VV0304)),COLORYELLOW,LINETHICK2;
顶:REF(H,BARSLAST(VV20304)),COLORYELLOW,LINETHICK1;
 {下跌三角形:绿色三角形画完介入}
 STICKLINE(VV0304,顶,底,0,0),COLORGREEN,LINETHICK2;
 DRAWLINE(VV20304,H,VV0304,L,0),COLORGREEN,LINETHICK2;{斜}
 DRAWLINE(VV20304,H,VV0304,顶,0),COLORGREEN,LINETHICK2;
 {上涨三角形:红色三角形画完出局}
 STICKLINE(VV20304 ,顶,底,0,0),COLOR009AFF,LINETHICK2;
 DRAWLINE(VV0304,L,VV20304,H,0),COLOR009AFF,LINETHICK2;{斜}
 DRAWLINE(VV0304,L,VV20304,底,0),COLOR009AFF,LINETHICK2;
 NN:=10;
 T11:=CONST(HHVBARS(V,NN));
 M:=10;
 Q1:=CONST(REF(HHVBARS(V,M),T11+1)+T11+1);
 Q0:IF(CURRBARSCOUNT<=T1+M+3 AND
CURRBARSCOUNT>=T1+1,CONST(REF(C,Q1)),DRAWNULL),COLORBLUE,LINETHICK3;
 DRAWTEXT(ISLASTBAR,Q0,’ 位置’)COLORBLUE,LINETHICK3;
 IF(CURRBARSCOUNT=Q1+1,Q0,DRAWNULL)LINETHICK5,COLORMAGENTA;
 M1:=CONST(LLVBARS(V,M));
 M0:IF(CURRBARSCOUNT<=M+7,CONST(IF(M1=0,O,REF(O,M1))),DRAWNULL)LINETHICK3,COLORMAGENTA;
IF(CURRBARSCOUNT=M1+1,M0,DRAWNULL)LINETHICK3,COLORYELLOW;
 DRAWTEXT(ISLASTBAR,M0,’ 纵轴1位置’)COLORLIMAGENTA;
 DRAWTEXT(ISLASTBAR,MA2,’关注均线角度’);
 过均必牛:SUM(CLOSE*VOL,FROMOPEN)/SUM(VOL,FROMOPEN),COLORYELLOW,DOTLINE,LINETHICK4;
 A7:=C-REF(C,1);
 A8:=100*EMA(EMA(A7,34),34)/EMA(EMA(ABS(A7),34),34);
 买点:(LLV(A8,2)=LLV(A8,7) AND COUNT(A8<0,2) AND CROSS(A8,MA(A8,2))),COLORRED,LINETHICK2,NODRAW;
 {DRAWTEXT(买点,0.5,’买点’),COLORYELLOW,LINETHICK2;}
 N7:=5;
 A01:=REF(H,N7)=HHV(H,2*N7+1);
 B01:=FILTER(A01,N7);
 C01:=BACKSET(B01,N7+1);
 D01:=FILTER(C01,N7);
 A02:=REF(L,N7)=LLV(L,2*N7+1);
 B02:=FILTER(A02,N7);
 C02:=BACKSET(B02,N7+1);
 D02:=FILTER(C02,N7);
 E01:=(REF(LLV(L,2*N7),1)+REF(HHV(H,2*N7),1))/2;
 E02:=(H+L)/2;
 H01:=(D01 AND NOT(D02 AND E01>=E02)) OR ISLASTBAR OR BARSCOUNT(C)=1;
 L01:=(D02 AND NOT(D01 AND E01<E02));
 H02:=D01 AND NOT(D02 AND E01>=E02);
 X01:=REF(BARSLAST(H01),1)+1;
 F01:=BACKSET(H01 AND COUNT(L01,X01)>0,LLVBARS(IF(L01,L,10000),X01));
 G01:=F01>REF(F01,1);
 I11:=BACKSET(G01,2);
 LD0:=I11>REF(I11,1);
 L02:=LD0 OR ISLASTBAR OR BARSCOUNT(C)=1;
 X02:=REF(BARSLAST(L02),1)+1;
 F02:=BACKSET(L02 AND COUNT(H02,X02)>0,HHVBARS(IF(H02,H,0),X02));
 G02:=F2>REF(F2,1);
 I02:=BACKSET(G02,2);
 HD0:=I2>REF(I2,1);
 R01:=BACKSET(ISLASTBAR,BARSLAST(HD0)+1);
 S01:=R01>REF(R01,1);
 T01:=BACKSET(ISLASTBAR,BARSLAST(LD0)+1);
 U01:=T01>REF(T01,1);
 R02:=BACKSET(S1,REF(BARSLAST(HD0),1)+2);
 S02:=R02>REF(R02,1);
 T02:=BACKSET(U1,REF(BARSLAST(LD0),1)+2);
 U02:=T02>REF(T02,1);
 NOTEXT1:DRAWLINE(S2,H,S1,H,1),LINETHICK4,COLORRED,POINTDOT;
 NOTEXT2:DRAWLINE(U2,L,U1,L,1),COLOR00FF00,LINETHICK4,POINTDOT;
 N02:=5;N3:=5;
 W:=INTPART(3*N3/5);
 AA11:=REF(L,W)=LLV(L,2*W+1);
 QY11:=BACKSET(AA11,W+1);
 CC11:=FILTER(QY11,W) AND L=LLV(L,W+1);
 DD11:=BARSLAST(CC11);
 DDTSS:=IF(CC11,CURRBARSCOUNT,0);
 DDTS11:=IF(DD11,REF(DDTSS,DD11),DDTSS);
 DDCS11:=CONST(DDTS11);
 DDTS22:=REF(DDTS11,DD11+1);
 DDCS22:=CONST(DDTS22);
 低点支撑M:DRAWLINE(CURRBARSCOUNT=DDCS22,L,CURRBARSCOUNT=DDCS11,L,1),POINTDOT,LINETHICK4;
 

{压力支撑}
 M00:=INTPART(3*N02/5);{压力线取}
 AAAA:=REF(H,M00)=HHV(H,2*M00+1);
 QYY:=BACKSET(AAAA,M+1);
 CCC:=FILTER(QYY,M) AND H=HHV(H,M+1);
 DDDD:=BARSLAST(CCC),NODRAW;
 GDTSS:=IF(CCC,CURRBARSCOUNT,0),NODRAW;
 DINGBUTSS:=IF(DDDD,REF(GDTSS,DDDD),GDTSS),NODRAW;
 GDCS11:=CONST(DINGBUTSS),NODRAW;
 DINGBUTS11:REF(DINGBUTSS,DDDD+1),NODRAW;
 GDCS22:=CONST(DINGBUTS11);
 高点压力M:DRAWLINE(CURRBARSCOUNT=GDCS22,H,CURRBARSCOUNT=GDCS11,H,1)
 ,COLORFF00FF,LINETHICK3,POINTDOT;
 P:=3;
 AB10:=REF(H,P)=HHV(H,2*P+1);
B001:=FILTER(AB10,P);
C001:=BACKSET(B001,P+1);
D001:=FILTER(C001,P);{高点}
 A002:=REF(L,P)=LLV(L,2*P+1);
B002:=FILTER(A002,P);
C002:=BACKSET(B002,P+1);
D002:=FILTER(C002,P);{低点}
 E001:=(REF(LLV(L,2*P),1)+REF(HHV(H,2*P),1))/2;
E002:=(H+L)/2;{高低点出现在同一K线上时可作取舍}
 H001:=(D001 AND NOT(D002 AND E001>=E002)) OR BARSCOUNT(C)=1;
 L001:=(D002 AND NOT(D001 AND E1<E002)); 
Z1:=STRCAT(HYBLOCK,’ ‘);
 Z2:=STRCAT(Z1,DYBLOCK);
 Z3:=STRCAT(Z2,’ ‘);
 DRAWTEXT_FIX(ISLASTBAR,0,0,7,STRCAT(Z3,GNBLOCK)),COLORRED;
 DRAWTEXT_FIX(ISLASTBAR,0.001,0.180,0,GNBLOCK),COLORCYAN;{概念};
 DRAWTEXT_FIX(1,0.13,0,0,DYBLOCK)COLOR00FFFF;
 DRAWTEXT_FIX(1,0.36,0.00,0,EXTERNSTR(0,2))COLORFFCC66;
 DRAWTEXT_FIX(1,0.0,0.063,0,EXTERNSTR(0,1))COLOR00FFFF;

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。