通达信连续九周画矩形源码 给指标写手的提

[复制链接]
查看33 | 回复0 | 2022-7-24 06:32:17 | 显示全部楼层 |阅读模式

通达信连续九周画矩形源码 给指标写手的提

给指标写手的提示………感谢真人老师。
[通达信指标] 通达信连续九周画矩形源码

T:=BARSLAST(WEEKOFYEAR!=REF(WEEKOFYEAR,1));
 L0:=LLV(L,T+1);
 L1:=REF(L0,T+1);
 L2:=REF(L1,T+1);
 L3:=REF(L2,T+1);
 L4:=REF(L3,T+1);
 L5:=REF(L4,T+1);
 L6:=REF(L5,T+1);
 L7:=REF(L6,T+1);
 L8:=REF(L7,T+1);
 H0:=HHV(H,T+1);
 H1:=REF(H0,T+1);
 H2:=REF(H1,T+1);
 H3:=REF(H2,T+1);
 H4:=REF(H3,T+1);
 H5:=REF(H4,T+1);
 H6:=REF(H5,T+1);
 H7:=REF(H6,T+1);
 H8:=REF(H7,T+1);
 TJ:=WEEKOFYEAR!=REF(WEEKOFYEAR,1);
 TJ1:=COUNT(TJ,TOTALBARSCOUNT);
 T0:=BARSLAST(CROSS(CONST(TJ1)-TJ1=0,0.5));
 T1:=BARSLAST(CROSS(CONST(TJ1)-TJ1=1,0.5));
 T2:=BARSLAST(CROSS(CONST(TJ1)-TJ1=2,0.5));
 T3:=BARSLAST(CROSS(CONST(TJ1)-TJ1=3,0.5));
 T4:=BARSLAST(CROSS(CONST(TJ1)-TJ1=4,0.5));
 T5:=BARSLAST(CROSS(CONST(TJ1)-TJ1=5,0.5));
 T6:=BARSLAST(CROSS(CONST(TJ1)-TJ1=6,0.5));
 T7:=BARSLAST(CROSS(CONST(TJ1)-TJ1=7,0.5));
 T8:=BARSLAST(CROSS(CONST(TJ1)-TJ1=8,0.5));
 NOTEXT1:IF(CONST(TJ1)-TJ1=0,CONST(H0),DRAWNULL),COLORYELLOW;
 NOTEXT2:IF(CONST(TJ1)-TJ1=0,CONST(L0),DRAWNULL),COLORYELLOW;
 STICKLINE(T0=0 OR BARSTATUS=2,CONST(H0),CONST(L0),0,0),COLORYELLOW;
 NOTEXT3:IF(CONST(TJ1)-TJ1=1,CONST(H1),DRAWNULL),COLORYELLOW;
 NOTEXT4:IF(CONST(TJ1)-TJ1=1,CONST(L1),DRAWNULL),COLORYELLOW;
 STICKLINE(T1=0 OR REFX(T0=0,1),CONST(H1),CONST(L1),0,0),COLORYELLOW;
 NOTEXT5:IF(CONST(TJ1)-TJ1=2,CONST(H2),DRAWNULL),COLORYELLOW;
 NOTEXT6:IF(CONST(TJ1)-TJ1=2,CONST(L2),DRAWNULL),COLORYELLOW;
 STICKLINE(T2=0 OR REFX(T1=0,1),CONST(H2),CONST(L2),0,0),COLORYELLOW;
 NOTEXT7:IF(CONST(TJ1)-TJ1=3,CONST(H3),DRAWNULL),COLORYELLOW;
 NOTEXT8:IF(CONST(TJ1)-TJ1=3,CONST(L3),DRAWNULL),COLORYELLOW;
 STICKLINE(T3=0 OR REFX(T2=0,1),CONST(H3),CONST(L3),0,0),COLORYELLOW;
 NOTEXT9:IF(CONST(TJ1)-TJ1=4,CONST(H4),DRAWNULL),COLORYELLOW;
 NOTEXT10:IF(CONST(TJ1)-TJ1=4,CONST(L4),DRAWNULL),COLORYELLOW;
 STICKLINE(T4=0 OR REFX(T3=0,1),CONST(H4),CONST(L4),0,0),COLORYELLOW;
 NOTEXT11:IF(CONST(TJ1)-TJ1=5,CONST(H5),DRAWNULL),COLORYELLOW;
 NOTEXT12:IF(CONST(TJ1)-TJ1=5,CONST(L5),DRAWNULL),COLORYELLOW;
 STICKLINE(T5=0 OR REFX(T4=0,1),CONST(H5),CONST(L5),0,0),COLORYELLOW;
 NOTEXT13:IF(CONST(TJ1)-TJ1=6,CONST(H6),DRAWNULL),COLORYELLOW;
 NOTEXT14:IF(CONST(TJ1)-TJ1=6,CONST(L6),DRAWNULL),COLORYELLOW;
 STICKLINE(T6=0 OR REFX(T5=0,1),CONST(H6),CONST(L6),0,0),COLORYELLOW;
 NOTEXT15:IF(CONST(TJ1)-TJ1=7,CONST(H7),DRAWNULL),COLORYELLOW;
 NOTEXT16:IF(CONST(TJ1)-TJ1=7,CONST(L7),DRAWNULL),COLORYELLOW;
 STICKLINE(T7=0 OR REFX(T6=0,1),CONST(H7),CONST(L7),0,0),COLORYELLOW;
 NOTEXT17:IF(CONST(TJ1)-TJ1=8,CONST(H8),DRAWNULL),COLORYELLOW;
 NOTEXT18:IF(CONST(TJ1)-TJ1=8,CONST(L8),DRAWNULL),COLORYELLOW;
 STICKLINE(T8=0 OR REFX(T7=0,1),CONST(H8),CONST(L8),0,0),COLORYELLOW;

 DRAWTEXT(T0=0,NOTEXT1*1.02,STRCAT(STRCAT('周高',VAR2STR(CONST(H0),2)),'元'))COLORYELLOW;
 DRAWTEXT(T0=0,NOTEXT2*0.98,STRCAT(STRCAT('周低',VAR2STR(CONST(L0),2)),'元'))COLORYELLOW;
 DRAWTEXT(T1=0,NOTEXT3*1.02,STRCAT(STRCAT('周高',VAR2STR(CONST(H1),2)),'元'))COLORYELLOW;
 DRAWTEXT(T1=0,NOTEXT4*0.98,STRCAT(STRCAT('周低',VAR2STR(CONST(L1),2)),'元'))COLORYELLOW;
 DRAWTEXT(T2=0,NOTEXT5*1.02,STRCAT(STRCAT('周高',VAR2STR(CONST(H2),2)),'元'))COLORYELLOW;
 DRAWTEXT(T2=0,NOTEXT6*0.98,STRCAT(STRCAT('周低',VAR2STR(CONST(L2),2)),'元'))COLORYELLOW;
 DRAWTEXT(T3=0,NOTEXT7*1.02,STRCAT(STRCAT('周高',VAR2STR(CONST(H3),2)),'元'))COLORYELLOW;
 DRAWTEXT(T3=0,NOTEXT8*0.98,STRCAT(STRCAT('周低',VAR2STR(CONST(L3),2)),'元'))COLORYELLOW;
 DRAWTEXT(T4=0,NOTEXT9*1.02,STRCAT(STRCAT('周高',VAR2STR(CONST(H4),2)),'元'))COLORYELLOW;
 DRAWTEXT(T4=0,NOTEXT10*0.98,STRCAT(STRCAT('周低',VAR2STR(CONST(L4),2)),'元'))COLORYELLOW;
 DRAWTEXT(T5=0,NOTEXT11*1.02,STRCAT(STRCAT('周高',VAR2STR(CONST(H5),2)),'元'))COLORYELLOW;
 DRAWTEXT(T5=0,NOTEXT12*0.98,STRCAT(STRCAT('周低',VAR2STR(CONST(L5),2)),'元'))COLORYELLOW;
 DRAWTEXT(T6=0,NOTEXT13*1.02,STRCAT(STRCAT('周高',VAR2STR(CONST(H6),2)),'元'))COLORYELLOW;
 DRAWTEXT(T6=0,NOTEXT14*0.98,STRCAT(STRCAT('周低',VAR2STR(CONST(L6),2)),'元'))COLORYELLOW;
 DRAWTEXT(T7=0,NOTEXT15*1.02,STRCAT(STRCAT('周高',VAR2STR(CONST(H7),2)),'元'))COLORYELLOW;
 DRAWTEXT(T7=0,NOTEXT16*0.98,STRCAT(STRCAT('周低',VAR2STR(CONST(L7),2)),'元'))COLORYELLOW;
 DRAWTEXT(T8=0,NOTEXT17*1.02,STRCAT(STRCAT('周高',VAR2STR(CONST(H8),2)),'元'))COLORYELLOW;
 DRAWTEXT(T8=0,NOTEXT18*0.98,STRCAT(STRCAT('周低',VAR2STR(CONST(L8),2)),'元'))COLORYELLOW;


太复杂了,语句太多,
简化如下

ZD:=DATE#WEEK;
 ZH:=H#WEEK;
 ZL:=L#WEEK;
 K0:=ZD>REF(ZD,1) OR BARSSINCE(C)=0;
 K1:=REFX(K0,1) OR ISLASTBAR;
 S1:=MOD(SUM(K0,0),2);
 {XXXXXXXXXXXXXXXXXXX图形显示XXXXXXXXXXXXXXXXX}
 N:=9;
 S2:=BACKSET(ISLASTBAR,SUMBARS(K0,N));
 STICKLINE((K0 OR K1) AND S2,ZH,ZL,0,0),COLORFFFFFF;
 DRAWLINE(K0 AND S1=1 AND S2,ZH,K1 AND S1=1 AND S2,ZH,0),COLORFFFFFF;
 DRAWLINE(K0 AND S1=1 AND S2,ZL,K1 AND S1=1 AND S2,ZL,0),COLORFFFFFF;
 DRAWLINE(K0 AND S1=0 AND S2,ZH,K1 AND S1=0 AND S2,ZH,0),COLORFFFFFF;
 DRAWLINE(K0 AND S1=0 AND S2,ZL,K1 AND S1=0 AND S2,ZL,0),COLORFFFFFF;
 DRAWTEXT(K0,ZH*1.02,VAR2STR(ZH,2)),COLOR0099AA;
 DRAWTEXT(K0,ZL*0.98,VAR2STR(ZL,2)),COLORAA9900;

652155345.png

652155345.png

 

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则