通达信成本计算主图公式
可计算起涨与下跌的压力和支撑位置
参数设置:起点(0,9999,1),终点(0,9999,1)
AA:=起点;
BB:=终点;
CYC:=IF(CAPITAL=0,(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);