只需一步,快速开始
2015-10-30 21:27| 发布者: admin| 查看: 56| 评论: 0
{主图叠加MACD 附语句注解说明 代码:} n:=SYSPARAM(3)-SYSPARAM(2)+1; w:=barslast(cross(BACKSET(BARSTATUS=2,n),0.5)); {定义叠加区间(从最后周期往前N天)} j:=w*0; {显示参数,规定了只在叠加区间才显示图象} {以下为要叠加的指标(MACD)。只显示数值,不画曲线;颜色和后面的叠加线对应} diff:"macd.diff",linethick0,COLORWHITE; dea:"macd.dea",linethick0,COLORYELLOW; macd:"macd.macd",linethick0,COLORMAGENTA; {以下求叠加比和叠加位移量} hh:=refx(hhv(h,n),n); {K线在叠加区间内的最大值} LL:=refx(LLv(L,N),n); {K线在叠加区间内的最小值} hf:=refx(hhv(max(max(diff,dea),macd),n),n); {叠加指标在叠加区间内的最大值} Lf:=refx(LLv(min(min(diff,dea),macd),n),n); {叠加指标在叠加区间内的最小值} b:=(hh-LL)/(hf-Lf); {叠加比} fc:=((hh+LL)-(hf+Lf)*b)/2; {叠加位移量} {以下为叠加指标在叠加后的曲线数值} df:=diff*b+fc+j; da:=dea*b+fc+j; u:=macd*b+fc+j; {画叠加后的MACD竖线} STICKLINE(w>=0 and u>fc,u,fc,0.01,1)COLORmagenta,POINTDOT; STICKLINE(w>=0 and u {以下画分段线,目的是不显示叠加后曲线数值} PARTLINE(w>=0,fc); PARTLINE(w>=0,df),COLORWHITE; PARTLINE(w>=0,da),COLORYELLOW; -------附上语句注解说明,只为让你举一反三,学以致用! -------------------------------------------------------------------------------- 示图