以下是通达信顶底搏杀公式
通达信顶底搏杀公式
源码
DRAWGBK(H>L,RGB(00,55,00),RGB(100,100,100),0,'背景图',0);
{数据}
峰:=PEAKBARS(H,8,1);
谷:=TROUGHBARS(L,10,1);
博杀:SUM(H*VOL,峰+1)/SUM(VOL,峰+1),COLORGREEN,NODRAW;
狩猎:SUM(L*VOL,谷+1)/SUM(VOL,谷+1),COLORMAGENTA,NODRAW;
多空:=IF(峰<谷,博杀,狩猎);
{正常波动区间}
DRAWBAND(博杀,RGB(00,55,00),狩猎,RGB(00,55,00));
{画K线}
{青色}
STICKLINE(C<=O,H,L,0.00001,0),COLORCYAN;
STICKLINE(C<=O,O,C,3,1),COLORCYAN;
{红色}
STICKLINE(C>O,C,O,3,0),COLOR000044;
STICKLINE(C>O,C,O,2.8,0),COLOR000055;
STICKLINE(C>O,C,O,2.4,0),COLOR000066;
STICKLINE(C>O,C,O,1.9,0),COLOR000077;
STICKLINE(C>O,C,O,1.4,0),COLOR000099;
STICKLINE(C>O,C,O,0.9,0),COLOR0000BB;
STICKLINE(C>O,C,O,0.5,0),COLOR0000DD;
STICKLINE(C>O,C,O,0.1,0),COLOR0000FF;
STICKLINE(C>O,H,L,0.00001,0),COLOR0000FF;
{数据线}
NOTEXT博:(IF(峰>0,博杀,DRAWNULL)),COLORWHITE,DOTLINE;{可删除}
NOTEXT狩:(IF(谷>0,狩猎,DRAWNULL)),COLORWHITE,DOTLINE;{可删除}
NOTEXT空:IF(多空=博杀,博杀,DRAWNULL),COLORGREEN,LINETHICK1;
NOTEXT多:IF(多空=狩猎,狩猎,DRAWNULL),COLORMAGENTA,LINETHICK1;
{标数字}
DRAWNUMBER(ISLASTBAR,博杀,博杀),COLORGREEN;
DRAWNUMBER(ISLASTBAR,狩猎,狩猎),COLORMAGENTA;