通达信划线公式主图

[复制链接]
查看138 | 回复0 | 2022-7-24 08:19:21 | 显示全部楼层 |阅读模式

通达信划线公式主图

参数N自行设定

A1:=REF(H,N)=HHV(H,2*N+1);
B1:=FILTER(A1,N);
C1:=BACKSET(B1,N+1);
D1:=FILTER(C1,N);{高点}
A2:=REF(L,N)=LLV(L,2*N+1);
B2:=FILTER(A2,N);
C2:=BACKSET(B2,N+1);
D2:=FILTER(C2,N);{低点}
E1:=(REF(LLV(L,2*N),1)+REF(HHV(H,2*N),1))/2;
E2:=(H+L)/2;{高低点出现在同一K线上时可作取舍}
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); {前二低}
T3:=BACKSET(U2,REF(BARSLAST(LD),1)+2);
U3:=T3>REF(T3,1); {前三低}
T4:=BACKSET(U3,REF(BARSLAST(LD),1)+2);
U4:=T4>REF(T4,1); {前四低}
R3:=BACKSET(S2,REF(BARSLAST(HD),1)+2);
S3:=R3>REF(R3,1); {前三高}
R4:=BACKSET(S3,REF(BARSLAST(HD),1)+2);
S4:=R4>REF(R4,1); {前四高}
短压0:DRAWLINE(S1,H,H,H,1),COLORRED;
短压:DRAWLINE(S2,H,S1,H,1),COLORRED;
短压1:DRAWLINE(S3,H,S1,H,1),COLORRED;
短压2:DRAWLINE(S4,H,S1,H,1),COLORRED;
中压:DRAWLINE(S1,H,S2,H,1),COLORYELLOW;
中压1:DRAWLINE(S3,H,S2,H,1),COLORYELLOW;
中压2:DRAWLINE(S4,H,S2,H,1),COLORYELLOW;
长压:DRAWLINE(S4,H,S3,H,1),COLORFF00FF;
长压1:DRAWLINE(S1,H,S3,H,1),COLORFF00FF;
长压2:DRAWLINE(S2,H,S3,H,1),COLORFF00FF;
短支:DRAWLINE(U2,L,U1,L,1),COLORGREEN;
短支1:DRAWLINE(U3,L,U1,L,1),COLORGREEN;
短支2:DRAWLINE(U4,L,U1,L,1),COLORGREEN;
中支:DRAWLINE(U3,L,U2,L,0);
中支1:DRAWLINE(U1,L,U2,L,0);
中支2:DRAWLINE(U4,L,U2,L,0);   
长支:DRAWLINE(U4,L,U3,L,0);
长支1:DRAWLINE(U1,L,U3,L,0);
长支2:DRAWLINE(U2,L,U3,L,0);
DRAWTEXT(S1,H*1.02,'前1高'),COLORRED;
DRAWTEXT(S2,H*1.02,'前2高'),COLORRED;
DRAWTEXT(S3,H*1.02,'前3高'),COLORRED;
DRAWTEXT(S4,H*1.02,'前4高'),COLORRED;
DRAWTEXT(U1,L*0.98,'前1低');
DRAWTEXT(U2,L*0.98,'前2低');
DRAWTEXT(U3,L*0.98,'前3低');
DRAWTEXT(U4,L*0.98,'前4低');
G5:DRAWLINE(HIGH>=HHV(HIGH,5),HIGH,LOW<=LLV(LOW,5),LOW,0),LINETHICK3;
D5:DRAWLINE(LOW<=LLV(LOW,5),LOW,HIGH>=HHV(HIGH,5),HIGH,0),LINETHICK3;
G13:DRAWLINE(HIGH>=HHV(HIGH,13),HIGH,LOW<=LLV(LOW,13),LOW,0),LINETHICK3;
D13:DRAWLINE(LOW<=LLV(LOW,13),LOW,HIGH>=HHV(HIGH,13),HIGH,0),LINETHICK3;
G34:DRAWLINE(HIGH>=HHV(HIGH,34),HIGH,LOW<=LLV(LOW,34),LOW,0),LINETHICK3;
D34:DRAWLINE(LOW<=LLV(LOW,34),LOW,HIGH>=HHV(HIGH,34),HIGH,0),LINETHICK3;
G55:DRAWLINE(HIGH>=HHV(HIGH,55),HIGH,LOW<=LLV(LOW,55),LOW,0),LINETHICK3;
D55:DRAWLINE(LOW<=LLV(LOW,55),LOW,HIGH>=HHV(HIGH,55),HIGH,0),LINETHICK3;

AA:=A1;
QY:=B1;
CC:=C1;
{DRAWICON(CC,H*1.02,2);}
DDD:=BARSLAST(CC);
GDTS:=IF(CC,CURRBARSCOUNT,0);
DINGBU:=IF(DDD,REF(H,DDD),H);{顶部}
DINGBUTS:=IF(DDD,REF(GDTS,DDD),GDTS);
DINGBU1:=REF(DINGBU,DDD+1);
GDCS1:=CONST(DINGBUTS);
DINGBUTS1:=REF(DINGBUTS,DDD+1);
GDCS2:=CONST(DINGBUTS1);
DINGBU2:=REF(DINGBU1,DDD+1);
MM:=IF(CURRBARSCOUNT>GDCS2,0,1);
高点压力:DRAWLINE(CURRBARSCOUNT=GDCS2,H,CURRBARSCOUNT=GDCS1,H,1) COLORGREEN,LINETHICK2;
DRAWLINE(CURRBARSCOUNT=GDCS2,H,ISLASTBAR,REF(H,GDCS2-1),1),COLOR0055FF,POINTDOT;
DRAWLINE(CURRBARSCOUNT=GDCS1,H,ISLASTBAR,REF(H,GDCS1-1),1),COLORYELLOW,POINTDOT;
AA1:=A2;
QY1:=B2;
CC1:=C2;
{DRAWICON(CC1,L*0.98,1);}
DD1:=D2;
DDTS:=IF(CC1,CURRBARSCOUNT,0);
YDB:=IF(DD1,REF(L,DD1),L);
DDTS1:=IF(DD1,REF(DDTS,DD1),DDTS);
DDCS1:=CONST(DDTS1);
ZDB:=REF(YDB,DD1+1);
DDTS2:=REF(DDTS1,DD1+1);
DDCS2:=CONST(DDTS2);
低点支撑:DRAWLINE(CURRBARSCOUNT=DDCS2,L,CURRBARSCOUNT=DDCS1,L,1) COLORRED,LINETHICK2;
ZGSTAR:=(高点压力+低点支撑)/2;
ZGEND:=CONST((高点压力+低点支撑)/2);
STARDAY:=IF(DDCS2<GDCS2,DDCS2,GDCS2);
中轨:DRAWLINE(CURRBARSCOUNT=STARDAY,ZGSTAR,ISLASTBAR,ZGEND,1),COLORFF55BB,LINETHICK2;
DRAWLINE(CURRBARSCOUNT=DDCS1,L,ISLASTBAR,REF(L,DDCS1-1),1),COLORMAGENTA,POINTDOT,;
DRAWLINE(CURRBARSCOUNT=DDCS2,L,ISLASTBAR,REF(L,DDCS2-1),1),COLORCYAN,POINTDOT;

EMA13:=EMA(C,13),COLORWHITE;
EMA21:=EMA(C,21),COLORYELLOW;
EMA34:=EMA(C,34),COLORFF00FF;
EMA60:=MA(C,60),COLORFFCC66;
VAR2:=(2*CLOSE+HIGH+LOW)/4;
VAR3:=IF(YEAR>=2099 AND MONTH>2,0,1);
VAR4:=LLV(LOW,5); VAR5:=HHV(HIGH,4);
散户:=EMA((VAR2-VAR4)/(VAR5-VAR4)*100,4)*VAR3;
庄家:=EMA(0.667*REF(散户,1)+0.333*散户,2)*VAR3;
DRAWTEXT(CROSS(散户,庄家) AND 散户<30,L*0.95,'←低吸'),COLORLIRED;
DRAWTEXT(CROSS(庄家,散户) AND 散户>70,H+0.05,'←高抛'),COLORGREEN;
DRAWICON(CROSS(散户,庄家) AND 散户<30,L-0.05,1);
DRAWICON(CROSS(庄家,散户) AND 散户>70,H+0.05,2);
VAR9:=CLOSE-REF(CLOSE,5);
VARA:=EMA(EMA(VAR9,5),5)/EMA(EMA(ABS(VAR9),5),5);
VARC:=EMA(EMA(VAR9,20),20)/EMA(EMA(ABS(VAR9),20),20);
卖出:=IF(VARA>0 AND CROSS(VARC,VARA),90,100);
DRAWICON(卖出<0,H+0.05,2);
 

043422729.png

043422729.png

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则