M1是周期参数,不要太大,大了就不好玩了,因为只做了10等分,
P是缩放参数,默认值1;运行有点慢。
{M1(5,20,10),P(1,10,1)}
HH:=CONST(HHV(H,M1));
LL:=CONST(LLV(L,M1));
BC:=(HH-LL)/10;
C1:=HH;
C2:=HH-BC*1;
C3:=HH-BC*2;
C4:=HH-BC*3;
C5:=HH-BC*4;
C6:=HH-BC*5;
C7:=HH-BC*6;
C8:=HH-BC*7;
C9:=HH-BC*8;
C10:=HH-BC*9;
C11:=LL;
W1:=INTPART(LWINNER(M1,C1)*100-LWINNER(M1,C2)*100)/P;
W2:=INTPART(LWINNER(M1,C2)*100-LWINNER(M1,C3)*100)/P;
W3:=INTPART(LWINNER(M1,C3)*100-LWINNER(M1,C4)*100)/P;
W4:=INTPART(LWINNER(M1,C4)*100-LWINNER(M1,C5)*100)/P;
W5:=INTPART(LWINNER(M1,C5)*100-LWINNER(M1,C6)*100)/P;
W6:=INTPART(LWINNER(M1,C6)*100-LWINNER(M1,C7)*100)/P;
W7:=INTPART(LWINNER(M1,C7)*100-LWINNER(M1,C8)*100)/P;
W8:=INTPART(LWINNER(M1,C8)*100-LWINNER(M1,C9)*100)/P;
W9:=INTPART(LWINNER(M1,C9)*100-LWINNER(M1,C10)*100)/P;
W10:=INTPART(LWINNER(M1,C10)*100-LWINNER(M1,C11)*100)/P;
T1:=IF(BACKSET(BARSTATUS=2,W1)=1,1,DRAWNULL);
NOTEXT1:C1*T1,COLOR008000,LINETHICK1;
T2:=IF(BACKSET(BARSTATUS=2,W2)=1,1,DRAWNULL);
NOTEXT2:C2*T2,COLOR008000,LINETHICK1;
T3:=IF(BACKSET(BARSTATUS=2,W3)=1,1,DRAWNULL);
NOTEXT3:C3*T3,COLOR008000,LINETHICK1;
T4:=IF(BACKSET(BARSTATUS=2,W4)=1,1,DRAWNULL);
NOTEXT4:C4*T4,COLOR008000,LINETHICK1;
T5:=IF(BACKSET(BARSTATUS=2,W5)=1,1,DRAWNULL);
NOTEXT5:C5*T5,COLOR008000,LINETHICK1;
T6:=IF(BACKSET(BARSTATUS=2,W6)=1,1,DRAWNULL);
NOTEXT6:C6*T6,COLOR008000,LINETHICK1;
T7:=IF(BACKSET(BARSTATUS=2,W7)=1,1,DRAWNULL);
NOTEXT7:C7*T7,COLOR008000,LINETHICK1;
T8:=IF(BACKSET(BARSTATUS=2,W8)=1,1,DRAWNULL);
NOTEXT8:C8*T8,COLOR008000,LINETHICK1;
T9:=IF(BACKSET(BARSTATUS=2,W9)=1,1,DRAWNULL);
NOTEXT9:C9*T9,COLOR008000,LINETHICK1;
T10:=IF(BACKSET(BARSTATUS=2,W10)=1,1,DRAWNULL);
NOTEXT10:C10*T10,COLOR008000,LINETHICK1;
STR1:=STRCAT(CON2STR(M1,0),'D');
DRAWTEXT(ISLASTBAR,HH,STR1),COLOR008000,DRAWABOVE;
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);