以下是通达信转折换手主图公式源码
通达信转折换手主图公式源码
高低点转折的累计换手,
包含形成高或低点的天数和换手。
同时指出涨跌停的个数,包含ST *ST
如果不喜欢ST,
可以去掉最后两行源码的显示.
含ST 和 *ST 在涨跌停标记
如果不喜欢,
你可以去掉最后两行源码的显示.
源码
{转折换手}
N:=(1,1000,1);
T:=10*N;
A:=H=HHV(H,T) AND HHV(H,T)>REF(HHV(H,T),1);
B:=L=LLV(L,T) AND LLV(L,T)<REF(LLV(L,T),1);
C1:=DRAWLINE(A,H,B,L,0);
C2:=DRAWLINE(B,L,A,H,0);
GD:=C2=C1 AND A;
DD:=C2=C1 AND B;
GDT:=BARSLAST(GD);
DDT:=BARSLAST(DD);
D1:=HHV(H,T)>REF(HHV(H,T),1) AND ISLASTBAR AND C2!=C1;
D2:=LLV(L,T)<REF(LLV(L,T),1) AND ISLASTBAR AND C2!=C1;
D3:=IF(DD OR D2,GDT,IF(GD OR D1,DDT,DRAWNULL));
GHS:=VARCAT(VAR2STR(SUM("HSL.HSL",GDT),2),'%(');
DHS:=VARCAT(VAR2STR(SUM("HSL.HSL",DDT),2),'%(');
ZHG:=VARCAT(VARCAT(DHS,VAR2STR(DDT,0)),'天)');
ZHD:=VARCAT(VARCAT(GHS,VAR2STR(GDT,0)),'天)');
DRAWBAND(C1,RGB(250,0,250),C1,RGB(0,0,0));
DRAWBAND(C2,RGB(250,0,250),C2,RGB(0,0,0));
DRAWTEXT(D3>0 AND HHV(H,T)>REF(HHV(H,T),1),(H+L)/2,ZHG),COLORYELLOW,DRAWABOVE;
DRAWTEXT(D3>0 AND LLV(L,T)<REF(LLV(L,T),1),(H+L)/2,ZHD),COLORYELLOW,DRAWABOVE;
{涨跌停标记}
ST:=IF(NAMELIKE('ST'),1,0) OR IF(NAMELIKE('*ST'),1,0) ;
STZT:=C/REF(C,1)>=1.049 AND C=H;
STDT:=REF(C,1)/C>=1.049 AND C=L;
ZT:=C/REF(C,1)>=1.095 AND C=H;
DT:=REF(C,1)/C>=1.095 AND C=L;
ZTW:=BARSLAST(ZT<1);
DTW:=BARSLAST(DT<1);
STZTW:=BARSLAST(STZT<1);
STDTW:=BARSLAST(STDT<1);
DRAWTEXT(ZTW AND C>0,H,VAR2STR(ZTW,0)),COLORGRAY,DRAWABOVE;
DRAWTEXT(DTW AND C>0,L*0.96,VAR2STR(DTW,0)),COLORGRAY;
DRAWTEXT(STZTW AND C>0,H,VAR2STR(STZTW,0)),COLORGRAY,DRAWABOVE;
DRAWTEXT(STDTW AND C>0,L*0.96,VAR2STR(STDTW,0)),COLORGRAY;