九毛八公式指标
公式模块:
代码:
STICKLINE(ISEQUAL AND CLOSE>=REF(CLOSE,1),CLOSE,CLOSE,7,1),COLORRED;
STICKLINE(ISEQUAL AND CLOSE>=REF(CLOSE,1),HIGH,LOW,0,0),COLORRED;
STICKLINE(ISEQUAL AND CLOSE<REF(CLOSE,1),CLOSE,CLOSE,7,1),COLORFFFF00;
STICKLINE(ISEQUAL AND CLOSE<REF(CLOSE,1),HIGH,LOW,0,0),COLORFFFF00;
STICKLINE(ISUP ,HIGH,LOW,0,0),COLORRED;
STICKLINE(ISUP ,CLOSE,OPEN,7,1),COLORRED;
STICKLINE(ISDOWN ,HIGH,LOW,0,0),COLORFFFF00;
STICKLINE(ISDOWN ,OPEN,CLOSE,7,0),COLORFFFF00;
{fh:=hhv(high,3);
fl:=llv(low,3);}
fh:=HIGH;
fl:=LOW;
sell:=0*fh;
buy:=sell;
signal:=sell;
boxh:sell,linethick0;
boxl:sell,linethick0;
variable:hc=0,lc=0,bt=fh[1],bb=fh[1];
for i=1 to DATacOUNT do begin
IF hc>1 then begin
IF lc>2 and bt<=fh[i] then begin
buy[i]:=1;
for j=i-1 downto i-hc do begin
boxh[j]:=fh[i-hc];
boxl[j]:=fl[i-lc];
end;
hc:=0;lc:=0;
end;
IF bt>fh[i] then begin
IF lc>2 then begin
IF bb>=fl[i] then begin
sell[i]:=1;
for j=i-1 downto i-hc do begin
boxh[j]:=fh[i-hc];
boxl[j]:=fl[i-lc];
end;
hc:=-1;lc:=0;
end else begin
boxh[i]:=fh[i-hc];
boxl[i]:=fl[i-lc];
end;
end;
hc:=hc+1;
IF lc>1 then begin
IF bb<fl[i] then begin
lc:=lc+1;
IF lc=3 then begin
signal[i-hc+1]:=1;
for j=i downto i-hc+1 do begin
boxh[j]:=fh[i-hc+1];
boxl[j]:=fl[i-lc+1];
end;
end;
end else lc:=0;
end else
IF lc=1 then begin
IF bb<fl[i] then begin
lc:=lc+1;
end else lc:=0;
end;
IF lc=0 and hc>1 then begin
bb:=fl[i];
lc:=lc+1;
end;
end else begin hc:=0; lc:=0; end;
end else
IF hc=1 then begin
IF bt>fh[i] then
hc:=hc+1
else begin hc:=0;lc:=0; end;
end;
IF hc=0 then begin
bt:=fh[i];
hc:=hc+1;
end;
end;
PARTLINE(boxh and boxh=REF(boxh,1),boxh),coloryellow,LINEDOT;//DD
PARTLINE(boxl and boxl=REF(boxl,1),boxl),coloryellow,LINEDOT;//DI
STICKLINE((signal||REFX(buy||sell,1))&&boxh,boxh,boxl,0.1,0),LINEDOT,colorred;//ZY
DRAWICON(buy,LOW*0.98,4);
DRAWICON(sell,HIGH*1.02,5);
{}
CD:=boxh=0;
FTC:=BArslAST(CD);
XCD:=FTC;
XFD%:=(boxh-boxl)/boxl*100;
DRAWNUMBER(BARPOS=SYSPARAM(1),boxh*1.02,XCD,0),ALIGN2,COLORYELLOW,SHIFT2;
DRAWNUMBER(BARPOS=SYSPARAM(1),boxl*0.99,XFD%,2),ALIGN2,COLORCYAN,SHIFT2;
DRAWTEXT(BARPOS=SYSPARAM(1),boxh*1.02,'XCD '),,ALIGN2,COLORYELLOW,SHIFT1;
DRAWTEXT(BARPOS=SYSPARAM(1),boxl*0.99,'CFD% '),,ALIGN2,COLORCYAN,SHIFT1;
一,勾选仅随k线变动
二,修改最后四句代码
DRAWNUMBER(BARPOS=SYSPARAM(1) and boxh>0,boxh*1.02,XCD,0),ALIGN2,COLORYELLOW,SHIFT2;
DRAWNUMBER(BARPOS=SYSPARAM(1) and boxl>0,boxl*0.99,XFD%,2),ALIGN2,COLORCYAN,SHIFT2;
DRAWTEXT(BARPOS=SYSPARAM(1) and boxh>0,boxh*1.02,'XCD '),,ALIGN2,COLORYELLOW,SHIFT1;
DRAWTEXT(BARPOS=SYSPARAM(1) and boxl>0,boxl*0.99,'CFD% '),,ALIGN2,COLORCYAN,SHIFT1;