通达信小时图级别下周线标注主图公式
周线的实战意义不可忽视 想必大家都对前期指数期的红周五黑周一的特性有感触
这个指标是为了训练周线盘感而设计的 在小时级别下细节呈现使得周线的盘感更具有前瞻性
小时级别下标注出周开和周实体连线 推荐用于分类指数或者大盘指数的分析
参数A B 默认均为0 控制绘制线段连续使用
有红色青色标注K线的为周开第一小时 周实体连线在周末隔断把参数设为1
由于水平有限 代码冗长重复且混乱 后续会进一步完善 下一步思路是用框把周线振幅标出来
{-基础判定 中间定义赋值}
BASE:=PERIOD;
BASEW:=IF(BASE=6,1,0);
BASED:=IF(BASE=5,1,0);
BASEH:=IF(BASE=4,1,0);
BASEH&D:=IF(BASEH=1 OR BASED=1,1,0);
WEDA:=WEEKDAY;{当前周期所在星期数值};
WEDIF:=WEDA-REF(WEDA,4);
WS:=IF( WEDIF<1 AND REF(WEDIF,1)=1 ,1,0) NODRAW; {周始输出1}
R:=BARSLAST(WS=1) NODRAW; {上个WS=1 到当前的周期数}
WE:=IF(REFX(R,1)<R,1,0) NODRAW; {周末输出1 跨1周期未来函数}
CE:=IF(WE=1,1*CLOSE,DRAWNULL) POINTDOT; {周末输出本周收盘数值 其余无输出}
CS:=IF(WS=1,1*OPEN,DRAWNULL) POINTDOT COLORBLUE; {周始输出本周开数值 其余无输出}
M13:=IF(BASEH=1,MA(CLOSE,52),DRAWNULL) COLORWHITE;{小时级别13日线}
M20:=IF(BASEH=1,MA(CLOSE,80),DRAWNULL) COLORCYAN;{小时级别20日线}
{-周实体折线输出}
SL:=IF( CE>0 AND CE<REF(OPEN,R),1,0); {CE存在且CE<CS BARSLAST(CS=OPEN) C1>BARSSINCEN(CS=OPEN,19) SL:=IF( CE>0 AND CE<REF(OPEN,R) AND COUNT(CS=OPEN,20)=1 ,1,0);}
TT:IF(CE>0,CS-REF(OPEN,R),DRAWNULL) NODRAW; {测试 只有在周一 CS=REF(OPEN,R)}
SPLAS:=IF(CS=OPEN,DAY,DRAWNULL);
SPLAE:=IF(CE=CLOSE,DAY,DRAWNULL);
SR:=BARSLAST(SPLAS>0);
R2:=IF(CE=CLOSE,SPLAE-SPLAS,DRAWNULL);{当周}
DRAWLINE(CS=OPEN,CS,CE=CLOSE AND SL=0,CE,A) COLORLIMAGENTA LINETHICK1 DOTLINE; {输出实体线段-阳}
DRAWLINE(WS=1 ,CS,WE=1 AND SL=1,CE,B) COLORWHITE LINETHICK1 DOTLINE; {输出实体线段-阴}
{-周起始小时标注}
IO:=IF( CLOSE>OPEN ,1,0); {IO:=IF( CLOSE>REF(CLOSE,1) , 0.998*CLOSE,1.002*OPEN);} {DRAWTEXT(WS=1,IO,'O');}
STICKLINE(WS=1 AND CLOSE>OPEN,OPEN,CLOSE,1,IO) COLORRED ;{阳线-输出周起始实体}
STICKLINE(WS=1 AND CLOSE>OPEN,LOW,HIGH,0.01,IO) COLORRED ;{阳线-输出周开第一小时上下影}
STICKLINE(WS=1 AND CLOSE<OPEN,OPEN,CLOSE,1,IO) COLORCYAN;{阴线-输出周起始实体}
STICKLINE(WS=1 AND CLOSE<OPEN,LOW,HIGH,0.01,IO) COLORCYAN;{阴线-输出周起始上下影}
{-周起振幅柱状线标示 未完成 效果不佳 建议注销掉}
{WH:=IF( CS=OPEN,HHV(HIGH,R),DRAWNULL );{S-E}
{WL:=IF( CS=OPEN,LLV(HIGH,R),DRAWNULL );{S-E}
WH:=IF( CE=CLOSE,HHV(HIGH,R),DRAWNULL );{E-S}
WL:=IF( CE=CLOSE,LLV(HIGH,R),DRAWNULL );{E-S}
{DRAWLINE(WL=LOW,WL,WH=HIGH,WH,A) COLORLIGREEN; }{输出振幅线段};
RR:=BARSNEXT(WE=1);
RRE:=REFX(CLOSE,RR);
STICKLINE(WS=1 AND CS>0 AND RRE>CS,OPEN,RRE,RR,-1) COLORLIMAGENTA;
STICKLINE(WS=1 AND CS>0 AND RRE<CS,OPEN,RRE,RR,-1) COLORBLUE;
DRAWLINE(WS=1 ,RRE,WE=1 AND CE<REF(OPEN,R),CE,B) COLORBLUE DOTLINE;
DRAWLINE(WS=1 ,RRE,WE=1 AND CE>REF(OPEN,R),CE,B) COLORLIMAGENTA DOTLINE;