通达信趋势顶底彩带主图+量副图公式源码
DRAWBAND(MA(CLOSE,5),RGB(200,150,200),MA(CLOSE,10),RGB(83,123,68));
DRAWKLINE(H,O,L,C);
狼上轨:REF(HHV(H,21),1),COLORGRAY;
中轨:REF((HHV(H,63)+LLV(L,63))/2,1),COLORYELLOW;
狼下轨:REF(LLV(L,126),1),COLORRED;
顶:=HHV(H,21);
底:=LLV(L,126);
H19:=底+(顶-底)*0.618;
H中:=底+(顶-底)*0.5;
H61:=底+(顶-底)*1.236;
起点H80:=底+(顶-底)*0.382;
【底】:REFDATE(底,DATE),COLORRED;
【0.618】:REFDATE(H19,DATE),COLORGREEN,POINTDOT;
【0.5】:REFDATE(H中,DATE),COLORWHITE,POINTDOT;
【1.236】:REFDATE(H61,DATE),COLORLIRED,POINTDOT;
【0.382】:REFDATE(起点H80,DATE),COLORBLUE;
【顶】:REFDATE(顶,DATE),COLORGREEN;
DRAWNUMBER(ISLASTBAR ,起点H80,起点H80),COLORRED;
{设置参数:N,1,100,10}
T1:=CONST(LLVBARS(LOW,10));
T1HIGH:=CONST(REF(HIGH,T1));
CC:=CONST(CURRBARSCOUNT);
T2:=CONST(BARSLAST(CURRBARSCOUNT>CC+T1 AND H>T1HIGH));
T2HIGH:=CONST(REF(HIGH,T2));
T3:=CONST(BARSLAST(CURRBARSCOUNT>CC+T2 AND HIGH>T2HIGH));
T3HIGH:=CONST(REF(HIGH,T3));
猎击线:DRAWLINE(CURRBARSCOUNT=T3+1, T3HIGH, ISLASTBAR, T3HIGH, 1),LINETHICK2,COLOR0000FF;
DRAWTEXT(ISLASTBAR, T3HIGH, '猎击线')LINETHICK1,COLOR0000FF;
AABB:=CROSS(MA(C,3),MA(C,8)) AND MA(C,8)>REF(MA(C,8),1) ;
STICKLINE(AABB AND PERIOD>4,L,L*0.990,6,0),COLORRED;
AA:=起点;
BB:=终点;
CYC:=IF(C>900,(SUM(C,AA)-SUM(C,BB))/(AA-BB),(SUM(AMOUNT,AA)-SUM(AMOUNT,BB))/(SUM(VOL,AA)-SUM(VOL,BB))/100);
区间成本:CONST(CYC),NODRAW;
区间换手:(SUM(VOL,AA)-SUM(VOL,BB))/CAPITAL*100,NODRAW;
计算周期:AA-BB,NODRAW;
HH:=REFDATE(HHV(H,起点),DATE);
LL:=REFDATE(LLV(L,起点),DATE);
N1:=IF(PERIOD=7,1.05,IF(PERIOD=6,1.02,1.01));
N2:=IF(PERIOD=7,0.95,IF(PERIOD=6,0.98,0.99));
STICKLINE(CURRBARSCOUNT<=终点,区间成本*N1,区间成本*N2,5,0),COLOR808080;
STICKLINE(CURRBARSCOUNT<=终点,区间成本,区间成本,5,0),COLORWHITE;
STICKLINE(CURRBARSCOUNT=起点,HH,LL,0,-1),COLORYELLOW;
STICKLINE(CURRBARSCOUNT=终点,HH,LL,0,-1),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=起点,LL,'起点'),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=终点,LL,'终点'),COLORWHITE;
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
高区:IF(CURRBARSCOUNT<=60, CONST(IF(ISLASTBAR=1,HHV(H, BARSLAST(CURRBARSCOUNT=60)),0)),DRAWNULL),COLORRED,DOTLINE;
低区:IF(CURRBARSCOUNT<=60, CONST(IF(ISLASTBAR=1,LLV(L, BARSLAST(CURRBARSCOUNT=60)),0)),DRAWNULL),COLORMAGENTA,DOTLINE;
STICKLINE(CCI>=200 AND H>=高区,O,C,2,0),COLORGREEN;
STICKLINE(CCI<=100 AND L<=低区,O,C,2,0),COLORYELLOW;
参数N,1,100,10
M,1,100,5......起点0..9999.8;;终点0.9999.1
下面是量
DRAWBAND(MA(VOL,5),RGB(155,50,50),MA(VOL,21),RGB(83,123,68));
WOL:IF(CURRBARSCOUNT=1 AND PERIOD=5,VOL*240/FROMOPEN,DRAWNULL),NODRAW;
STICKLINE(CURRBARSCOUNT=1 AND PERIOD=5,WOL,0,3,-1),COLORFFFFFF;
VOLUME:VOL,VOLSTICK; V5:MA(VOLUME,5)COLORWHITE; V10:MA(VOLUME,10)COLORYELLOW;
V21:MA(VOLUME,21)COLORGREEN; VAR1:=VOL/((HIGH-LOW)*2-ABS(CLOSE-OPEN));
主买:IF(CLOSE>OPEN,VAR1*(HIGH-LOW),IF(CLOSE<OPEN,VAR1*((HIGH-OPEN)+(CLOSE-LOW)),VOL/2)),COLORRED,POINTDOT;
主卖:IF(CLOSE>OPEN,VAR1*((HIGH-CLOSE)+(OPEN-LOW)),IF(CLOSE<OPEN,VAR1*(HIGH-LOW),VOL/2)),COLORYELLOW,POINTDOT;
N1:=21;
顶:=HHV(V,120);
底:=LLV(V,120);
H19:=底+(顶-底)*0.618;
H中:=底+(顶-底)*0.5;
H61:=底+(顶-底)*1.236;
起点H80:=底+(顶-底)*0.382;
【底】:REFDATE(底,DATE),COLORGREEN;
【0.618】:REFDATE(H19,DATE),COLORGREEN,POINTDOT;
【0.5】:REFDATE(H中,DATE),COLORWHITE,POINTDOT;
【1.236】:REFDATE(H61,DATE),COLORLIRED,POINTDOT;
【0.382】:REFDATE(起点H80,DATE),COLORBLUE;
【顶】:REFDATE(顶,DATE),COLORCYAN;
倍量柱:=V/REF(V,1)>1.89;
STICKLINE(倍量柱 AND C>O,V,V/2,1,0)COLORYELLOW;