与"没事弄来玩的指标"之一一样,可以按这个方法改造成你所需要的指标 INPUT:N(10,1,999);
////条件成立时,向右画一水平射线,有碰到k线就停止,沒有的话就继续延伸,/////////////
CKH:=H=HHV(H,N) ; //此行可以自设条件
CCH:=H; //此行可以自设以什么高度画水平线
HH:=H; LL:=L;
for i=lbound(CKH) to datacount do begin
if CKH[i] then begin
for j=i+1 to datacount do begin
if HH[j]>=CCH[i] and CCH[i]>=HH[j-1] then break;
end;
if j<datacount+1 then SPH[i]:=j-i;
end;
end;
DRAWSL(CKH AND (SPH>N OR SPH=0),CCH,0,SPH,0) linedot;
DRAWNUMBER(CKH AND (SPH>N OR SPH=0),H,CCH,2);
////////////////////////////////////////////////////////////
CKL:=L=LLV(L,N); //此行可以自设条件
CCL:=L; //此行可以自设以什么高度画水平线
for i=lbound(CKL) to datacount do begin
if CKL[i] then begin
for j=i+1 to datacount do begin
if LL[j-1]>=CCL[i] and CCL[i]>=LL[j] then break;
end;
if j<datacount+1 then SPL[i]:=j-i;
end;
end;
DRAWSL(CKL AND (SPL>N-1 OR SPL=0) ,CCL,0,SPL,0) linedot;
DRAWNUMBER(CKL AND (SPL>N OR SPL=0),L,CCL,2);///////////以下应用上面的定点画趋势线///////////////////////
高1:=SUMBARS(CKH AND (SPH>N OR SPH=0),1);
高2:=SUMBARS(CKH AND (SPH>N OR SPH=0),2);
高3:=SUMBARS(CKH AND (SPH>N OR SPH=0),3);
高4:=SUMBARS(CKH AND (SPH>N OR SPH=0),4);低1:=SUMBARS(CKL AND (SPL>N OR SPL=0),1);
低2:=SUMBARS(CKL AND (SPL>N OR SPL=0),2);
低3:=SUMBARS(CKL AND (SPL>N OR SPL=0),3);
低4:=SUMBARS(CKL AND (SPL>N OR SPL=0),4);DRAWLINE(datacount-高2[datacount]+1=BARPOS,H,datacount-高1[datacount]+1=BARPOS,H,1);
DRAWLINE(datacount-高3[datacount]+1=BARPOS,H,datacount-高2[datacount]+1=BARPOS,H,0);
DRAWLINE(datacount-高4[datacount]+1=BARPOS,H,datacount-高3[datacount]+1=BARPOS,H,0); DRAWLINE(datacount-低2[datacount]+1=BARPOS,L,datacount-低1[datacount]+1=BARPOS,L,1);
DRAWLINE(datacount-低3[datacount]+1=BARPOS,L,datacount-低2[datacount]+1=BARPOS,L,0);
DRAWLINE(datacount-低4[datacount]+1=BARPOS,L,datacount-低3[datacount]+1=BARPOS,L,0); |