通达信趋势划线主图公式
A1:=REF(H,N)=HHV(H,2*N+1);
B1:=BACKSET(A1,N+1);
C1:=FILTER(B1,N) AND H=HHV(H,N+1);
D1:=BARSLAST(C1);
E1:=IF(C1,CURRBARSCOUNT,0);
F1:=IF(D1,REF(E1,D1),E1);
GDCS1:=CONST(F1);
GDCS2:=CONST(REF(F1,D1+1));
压力1:DRAWLINE(CURRBARSCOUNT=GDCS2,H,CURRBARSCOUNT=GDCS1,H,1),
COLORFF00FF,LINETHICK2;
AA1:=REF(L,N)=LLV(L,2*N+1);
BB1:=BACKSET(AA1,N+1);
CC1:=FILTER(BB1,N) AND L=LLV(L,N+1);
DD1:=BARSLAST(CC1);
EE1:=IF(CC1,CURRBARSCOUNT,0);
FF1:=IF(DD1,REF(EE1,DD1),EE1);
DDCS1:=CONST(FF1);
DDCS2:=CONST(REF(FF1,DD1+1));
支撑1:DRAWLINE(CURRBARSCOUNT=DDCS2,L,CURRBARSCOUNT=DDCS1,L,1),COLORFF00FF,LINETHICK2;
M:=INTPART(3*N/5);
A2:=REF(H,M)=HHV(H,2*M+1);
B2:=BACKSET(A2,M+1);
C2:=FILTER(B2,M) AND H=HHV(H,M+1);
D2:=BARSLAST(C2);
E2:=IF(C2,CURRBARSCOUNT,0);
F2:=IF(D2,REF(E2,D2),E2);
DCS1:=CONST(F2);
DCS2:=CONST(REF(F2,D2+1));
压力2:DRAWLINE(CURRBARSCOUNT=DCS2,H,CURRBARSCOUNT=DCS1,H,1),COLORYELLOW,LINETHICK2;
{虚线若不要,以下可删掉}
AA2:=REF(L,M)=LLV(L,2*M+1);
BB2:=BACKSET(AA2,M+1);
CC2:=FILTER(BB2,M) AND L=LLV(L,M+1);
DD2:=BARSLAST(CC2);
EE2:=IF(CC2,CURRBARSCOUNT,0);
FF2:=IF(DD2,REF(EE2,DD2),EE2);
DDC1:=CONST(FF2);
DDC2:=CONST(REF(FF2,DD2+1));
支撑2:DRAWLINE(CURRBARSCOUNT=DDC2,L,CURRBARSCOUNT=DDC1,L,1),COLORYELLOW,LINETHICK2;
DRAWLINE(CURRBARSCOUNT=GDCS1,H,ISLASTBAR,REF(H,GDCS1-1),1),COLORWHITE,POINTDOT,LINETHICK3;
DRAWLINE(CURRBARSCOUNT=GDCS2,H,ISLASTBAR,REF(H,GDCS2-1),1),COLORWHITE,POINTDOT,LINETHICK3;
DRAWLINE(CURRBARSCOUNT=DDCS1,L,ISLASTBAR,REF(L,DDCS1-1),1),COLORWHITE,POINTDOT,LINETHICK3;
DRAWLINE(CURRBARSCOUNT=DDCS2,L,ISLASTBAR,REF(L,DDCS2-1),1),COLORWHITE,POINTDOT,LINETHICK3;
DRAWLINE(CURRBARSCOUNT=DCS1,H,ISLASTBAR,REF(H,DCS1-1),1),COLORWHITE,POINTDOT,LINETHICK3;
DRAWLINE(CURRBARSCOUNT=DCS2,H,ISLASTBAR,REF(H,DCS2-1),1),COLORWHITE,POINTDOT,LINETHICK3;
DRAWLINE(CURRBARSCOUNT=DDC1,L,ISLASTBAR,REF(L,DDC1-1),1),COLORWHITE,POINTDOT,LINETHICK3;
DRAWLINE(CURRBARSCOUNT=DDC2,L,ISLASTBAR,REF(L,DDC2-1),1),COLORWHITE,POINTDOT,LINETHICK3;
涨家数:INDEXADV,NODRAW, ;
跌家数:INDEXDEC,NODRAW,COLORGREEN;
C3:=REF(C,1);
涨停:=IF((C-C3)*100/C3>=(10-0.01*100/C3),1,0);
STICKLINE(涨停,OPEN,CLOSE,2.5,0),COLORRED;
跌停:=IF((C3-C)*100/C3>=(10-0.01*100/C3),1,0);
STICKLINE(跌停,OPEN,CLOSE,2.5,0),COLORGREEN;
VAR1:=CLOSE>REF(CLOSE,1) AND CLOSE>REF(CLOSE,2);
K:=(C+H+L)/3;
D:=MA(K,4);
DRAWTEXT(REF(C,1)>D AND C<D AND D>REF(D,1),H*0.95, 'S'),COLORGREEN;
DRAWTEXT(REF(C,1)<D AND C>D AND D<REF(D,1),L*0.98 ,'B'),COLORRED;
{自动分割画线}
DDD1:=DRAWLINE(C=HHV(C,60),HHV(H,3),C=HHV(C,30) AND C<HHV(C,45),
HHV(HIGH,3),1);
EEE1:=DRAWLINE(C=LLV(C,60),LOW,C=LLV(C,30) AND C>LLV(C,45),LLV(LOW,3),1),
LINETHICK2;
E1P:DRAWLINE(C=LLV(C,30),LOW,C=LLV(C,10) AND C>LLV(C,22),LLV(LOW,3),1),
LINETHICK1,COLORBLUE;
E1PP:DRAWLINE(C=LLV(C,10),LOW,C=LLV(C,5) AND C>LLV(C,10),LLV(LOW,3),1),
LINETHICK1,COLORRED;
日:=181;昨前:=74;
高1:=REF(HHV(H,日),昨前);
低1:=REF(LLV(L,日),昨前),COLORBLUE,LINETHICK3;
H1:=高1-(高1-低1)*0.191,POINTDOT;
H2:=高1-(高1-低1)*0.382,POINTDOT;
H3:=高1-(高1-低1)*0.5,POINTDOT;
H4:=高1-(高1-低1)*0.618,POINTDOT;
H5:=高1-(高1-低1)*0.809,COLORBLUE,POINTDOT;
============
n=8 m1=13 m2=55 m3=155 |