SLOPE1:=0;
SLOPE2:=10000;
LEN:=200;
DIRECT1:=2;
DIRECT2:=0;
MN:=5;
MDT:=1220505;
X1:=BArslAst(DATE=1220104);{年内周期数}
X2:=POW(1.01,X1);{每天一个点}
X3:=REFDATE(CLOSE,1220104)*X2;{收益量}
收益曲线:IF(YEAR=2022,X3,DRAWNULL),POINTDOT,COLORYELLOW,LINETHICK2;{收益曲线}
DRAWTEXT(ISLASTBAR,X3,VAR2STR(X2*100,1)),COLORYELLOW;
DRAWTEXT(ISLASTBAR,CLOSE,VAR2STR((CLOSE/REF(CLOSE,X1)-1)*100,1)),COLORYELLOW;
DRAWNUMBER(ISLASTBAR,X3*1.05,DATE+19000000);
{DRAWSL(COND,PRICE,SLOPE,LEN,DIRECT);}
年:DRAWSL(YEAR=2022,REFDATE(O,1220104),SLOPE1,LEN,DIRECT1),COLORWHITE,LINETHICK2;{横线}
DRAWSL(DATE=1220104,REFDATE(O,1220104),SLOPE2,LEN,DIRECT2),COLORWHITE,LINETHICK2;{竖线}
月:DRAWSL(MONTH=MN,REFDATE(O,MDT),0,200,2),COLORCYAN,LINETHICK2;{横线}
DRAWSL(DATE=MDT,REFDATE(O,MDT),10000,200,0),COLORCYAN,LINETHICK2;{竖线}
{当COND条件满足时,在PRICE位置画斜线,SLOPE为斜率,
LEN为长度,DIRECT为0向右延伸,1向左延伸,2双向延伸.
注意:
1.k线间的纵向高度差为SLOPE;
2.SLOPE为0时,为水平线;
3.SLOPE为10000时,为垂直线,LEN为向上的像素高度,DIRECT表示向上或向下延伸;
4.SLOPE和LEN支持变量;}
{周线识别}
WT:=BARSLAST(WEEkdAY!=REF(WEEKDAY,1));
{星期一位置标识坚线,是星期一都画线}
STICKLINE(WEEKDAY=1,CONST(HHV(H,WT+3)),CONST(LLV(L,WT-3)),0,-1),COLORLIGRAY;
{只画最近一个星期一位置标识坚线}
STICKLINE(CURRBARSCOUNT=CONST(BARSLAST(WEEKDAY=1))+1,CONST(HHV(H,WT+3)),CONST(LLV(L,WT-3)),0,-1),COLORYELLOW;
DRAWKLINE(H,O,L,C);{重画K线便于看图};
评论(0)