fh:=h;fl:=l;
for p=datacount-1 downto 1 do begin
if fh[p]<fh[p+1] then
fh[p]:=fh[p+1];
if fl[p]>fl[p+1] then
fl[p]:=fl[p+1];
end;
qk:=l>ref(h,1)OR H<ref(L,1);
G:=IF(l>ref(h,1),L,IF(H<ref(L,1),ref(L,1),0));
D:=IF(l>ref(h,1),ref(H,1),IF(H<ref(L,1),H,0));
S:=IF(l>ref(h,1),2,IF(H<ref(L,1),1,0));
tj:=s=2 and fL<=G AND fL>=D OR s=1 and fH<G AND fH>=D ;
w:=BARSSINCE(BACKSET(BARSTATUS=2,BArslAST(TJ*BARPOS=BARPOS)+1))+1;
DD:=DATE;
最近缺口日:REF(DD,W-1)+19000000,LINETHICK0,COLORAAFF33;
S1:=IF(ref(S,W-1)=2,ref(fL,w-1),IF(ref(S,W-1)=1,ref(fH,w-1),0));
S2:=IF(ref(S,W-1)=2,ref(D,w-1),IF(ref(S,W-1)=1,ref(G,w-1),0));
A:=MAX(S1,S2);
B:=MIN(S1,S2);
缺口:B[datacount],COLORWHITE,LINETHICK,,PRECISION2;
→:A[datacount],COLORWHITE,LINETHICK,PRECISION2;
STICKLINE(w,S1,S2,15,0),COLORGRAY;
DRAWTEXT(BARSTATUS=2,A,NUMTOSTR(B,2)+'-'+NUMTOSTR(A,2)),COLOR0099CC,ALIGN2;{显示缺口数字 可删除}
hh:=h;LL:=L;DD:=DATE;
gb:=SYSPARAM(1);
上突缺口:=LOW>REF(HIGH,1),COLOR00EEFF,LINETHICK0;
下突缺口:=HIGH<REF(LOW,1),COLOREE9933,LINETHICK0;
XQS:=ubound(下突缺口),LINETHICK0;
s1:=SUMBARS(上突缺口,1);
s2:=SUMBARS(上突缺口,2);
x1:=SUMBARS(下突缺口,1);
x2:=SUMBARS(下突缺口,2);
上突位置1:=gb-s1[gb]+1,LINETHICK0;
下突位置1:=gb-x1[gb]+1,LINETHICK0;
DRAWTEXT(下突缺口,h,'△'),COLOREE9933,PXUP15,ALIGN0;
{ _最新股票指标公式}
DRAWTEXT(下突缺口,ref(l,1),'▽'),COLOREE9933,ALIGN0;
DRAWTEXT(上突缺口,l,'▽'),COLOR00EEFF,ALIGN0;
DRAWTEXT(上突缺口,ref(h,1),'△'),COLOR00EEFF,PXUP15,ALIGN0;
XQ1:=LL[下突位置1-1];
XQD:=DD[下突位置1];
BXQ:=COUNT(RANGE(BARPOS,下突位置1,XQS) AND HH>XQ1,XQS-下突位置1)=1;
BXQ:=FILTER(BXQ,XQS-下突位置1);
SQ1:=HH[上突位置1-1];
SQD:=DD[上突位置1];
上缺日:IF(XQD<SQD,SQD+19000000,0),LINETHICK0,COLOR00EEFF;
下缺日:IF(SQD<XQD,XQD+19000000,0),LINETHICK0,COLOREE9933;
bsQ:=COUNT(RANGE(BARPOS,上突位置1,XQS) AND LL<SQ1,XQS-上突位置1)=1;BSQ:=FILTER(BSQ,XQS-上突位置1);
DRAWTEXT(BSQ,(o+c)/2,' \n 补'+STRRIGHT(NUMTOSTR(SQD,0),6)+'\n 上突缺口\n '+numtostr(SQ1,2)),COLORFF99FF;
DRAWTEXT(BSQ,SQ1,'←'),ALIGN0,COLOR00EEEE;
DRAWTEXT(BXQ,(o+c)/2,' \n 补'+STRRIGHT(NUMTOSTR(XQD,0),6)+'\n 下突缺口\n '+numtostr(XQ1,2)),COLOREEEE66;
DRAWTEXT(BXQ,XQ1,'←'),ALIGN0,COLOR00EEEE;