以下是通达信几个K线量能公式的源码分享(无源码的请下载附件导入)
彩色K
RQ:=IF(DATE>=1200824,1,0);
KCB:=IF(INBLOCK('科创板'),1,0);
CYB:=IF(INBLOCK('创业板') AND RQ,1,0);
STICKLINE(C/REF(C,1)>1.195 AND C=H AND (KCB OR CYB) AND PERIOD=5,O,C,3,0),COLORYELLOW;
STICKLINE(C/REF(C,1)<0.805 AND C=L AND (KCB OR CYB) AND PERIOD=5,O,C,3,0),COLORBLUE;
STICKLINE(C/REF(C,1)>1.095 AND C=H AND NOT(KCB OR CYB) AND PERIOD=5,O,C,3,0),COLORYELLOW;
STICKLINE(C/REF(C,1)<0.905 AND C=L AND NOT(KCB OR CYB) AND PERIOD=5,O,C,3,0),COLORBLUE;
{开板}
STICKLINE(H/REF(C,1)>1.195 AND C<H AND (KCB OR CYB) AND PERIOD=5,O,C,3,0),COLORMAGENTA;{炸板}
STICKLINE(L/REF(C,1)<0.805 AND C>L AND (KCB OR CYB) AND PERIOD=5,O,C,3,0),COLORGREEN;{撬板}
STICKLINE(H/REF(C,1)>1.095 AND C<H AND NOT(KCB OR CYB) AND PERIOD=5,O,C,3,0),COLORMAGENTA;{炸板}
STICKLINE(L/REF(C,1)<0.905 AND C>L AND NOT(KCB OR CYB) AND PERIOD=5,O,C,3,0),COLORGREEN;{撬板}
************************************************************************
1637255365.jpg
{-----------------涨跌K线}
买线:=EMA(C,4);
卖线:=EMA(SLOPE(C,21)*10+C,34);
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
STICKLINE(买线>=卖线,LOW,HIGH,0,0),COLORRED;
STICKLINE(买线>=卖线,CLOSE,OPEN,3,1),COLORRED;
STICKLINE(买线<卖线,LOW,HIGH,0,0),COLORCYAN;
STICKLINE(买线<卖线,CLOSE,OPEN,3,1),COLORCYAN;
STICKLINE(OPEN>CLOSE,CLOSE,OPEN,3,0),COLORCYAN;
{BU:=CROSS(买线,卖线);DRAWICON(BU,L-0.003,13);}
ZTB:=IF(INBLOCK('科创板'),1.2,IF(INBLOCK('创业板') AND DATE>1200823,1.2 ,IF(INBLOCK('ST板块'),1.05,1.1)));
DTB:=IF(INBLOCK('科创板'),0.8,IF(INBLOCK('创业板') AND DATE>1200823,0.8 ,IF(INBLOCK('ST板块'),0.95,0.9)));
STICKLINE(REF(C,1)*ZTB-C<0.0049 AND PERIOD=5,O,C,2.88,0),COLORYELLOW;{涨停板}
STICKLINE(C>REF(C,1)*1.101 AND PERIOD=5,C,REF(C,1)*1.1,2.88,0),COLOR000088;{区分10%和20%涨停}
STICKLINE(C-REF(C,1)*DTB<0.0051 AND PERIOD=5 ,O,C,2.88,0),COLORGREEN;{跌停板}
DRAWTEXT(L-REF(C,1)*DTB<0.0051 AND C>L AND PERIOD=5,L-0.05,' 撬板'),COLORCC00CC;
DRAWTEXT(REF(C,1)*ZTB-H<0.0049 AND H>C AND PERIOD=5,H-0.02,' 炸板'),COLOR00CC00;
DRAWTEXT(REF(C,1)*ZTB-C<0.0049 AND L-REF(C,1)*DTB<0.0051 AND PERIOD=5,L-0.05,'天堂板'),COLORCC00CC;
DRAWTEXT(REF(C,1)*ZTB-H<0.0049 AND C-REF(C,1)*DTB<0.0051 AND PERIOD=5,H-0.02,'地狱板'),COLOR00CC00;
************************************************************************
************************************************************************
量能:
万手:VOL/10000,LINETHICK0,NODRAW;
AA:=IF(CURRBARSCOUNT=1 AND PERIOD=5,VOL*240/FROMOPEN,DRAWNULL);
预测:AA/10000;
STICKLINE(CURRBARSCOUNT=1 AND PERIOD=5,AA,0,3,1),COLORYELLOW;
BB:=VOL/((HIGH-LOW)*2-ABS(CLOSE-OPEN));
主动买:=IF(CLOSE>OPEN,BB*(HIGH-LOW),IF(CLOSE<OPEN,
BB*((HIGH-OPEN)+(CLOSE-LOW)),VOL/2));
主买:主动买/10000,COLORRED,NODRAW;
主动卖:=IF(CLOSE>OPEN,0-BB*((HIGH-CLOSE)+(OPEN-LOW)),
IF(CLOSE<OPEN,0-BB*(HIGH-LOW),0-VOL/2));
主卖:-主动卖/10000,COLORGREEN,NODRAW;
差额:(主动买+主动卖)/10000,NODRAW;
CC:=(2*C+H+L)/4;
STICKLINE(CC>REF(CC,1),0,VOL,2,DRAWNULL),COLORRED;
STICKLINE(CC<REF(CC,1),0,VOL,2,DRAWNULL),COLORCYAN;
STICKLINE(CC=REF(CC,1),0,VOL,2,DRAWNULL),COLORWHITE;
{STICKLINE(C>-1,0,VOL,3,1),COLORRED;
STICKLINE(C<O ,0,VOL,3,1),COLORFFFF00;
STICKLINE(C=O AND C<REF(C,1),0,VOL,2,1),COLORFFFF00;
STICKLINE(C=O AND C>REF(C,1),0,VOL,2,1),COLORRED;}
STICKLINE(主动买>0,0,主动买,1,0),COLOR0000FF;
STICKLINE(主动卖<0,VOL,主动买,1,0),COLOR00FF00;
持币:IF(SAR(10,2,20)>=H,SAR(10,2,20),DRAWNULL),CIRCLEDOT,COLORGREEN;
持股:IF(SAR(10,2,20)<=L,SAR(10,2,20),DRAWNULL),CIRCLEDOT,COLORMAGENTA;
五日: MA(V,5) COLORFFFFFF LINETHICK2;
三十四日: MA(V,34) COLORFF80FF LINETHICK2;
一百四十四日: MA(V,144) COLOR00FFFF LINETHICK1;
163888365.jpg
|