variable:cc=0;
/////////////////////////////////模型1
hi:=ref(hhv(h,10),1);
lo:=ref(llv(l,10),1);
PKKD:=h>hi;
PDKK:=l<lo;
if cc>0 and PDKK then begin
Y1:cc>0 and PDKK ,linethick0;
if islastbar then
DEBUGFILE('E:\TEST.TXT',' Y1:%.0f',Y1);//輸出Y1
pc:=min(max(holding,0),SS);
kc:=SS-pc;
if pc>0 then begin
sell(1=1,pc,limitr,min(o,lo-0.2)-0.6);
Y1pc:1,linethick0;
if islastbar then
DEBUGFILE('E:\TEST.TXT',' Y1pc:%.0f',Y1pc);//輸出Y1pc
end
if kc>0 then begin
buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
Y1kc:1,linethick0;
if islastbar then
DEBUGFILE('E:\TEST.TXT',' Y1kc:%.0f',Y1kc);//輸出Y1kc
end
cc:=0;
end
if cc<0 and PKKD then begin
Y2:cc<0 and PKKD ,linethick0;
if islastbar then
DEBUGFILE('E:\TEST.TXT',' Y2:%.0f',Y2);//輸出Y2
pc:=min(abs(min(holding,0)),SS);
kc:=SS-pc;
if pc>0 then begin
sellshort(1=1,pc,limitr,max(o,hi+0.2)+0.6);
Y2pc:1,linethick0;
if islastbar then
DEBUGFILE('E:\TEST.TXT',' Y2pc:%.0f',Y2pc);//輸出Y2pc
end
if kc>0 then begin
buy(1,kc,limitr,max(o,hi+0.2)+0.6)
Y2kc:1,linethick0;
if islastbar then
DEBUGFILE('E:\TEST.TXT',' Y2kc:%.0f',Y2kc);//輸出Y2kc
end
cc:=0;
end
if cc=0 and PKKD then begin
Y3:cc=0 and PKKD ,linethick0;
if islastbar then
DEBUGFILE('E:\TEST.TXT',' Y3:%.0f',Y3);//輸出Y3
pc:=min(abs(min(holding,0)),SS);
kc:=SS-pc;
if pc>0 then begin
sellshort(1=1,pc,limitr,max(o,hi+0.2)+0.6);
Y3pc:1,linethick0;
if islastbar then
DEBUGFILE('E:\TEST.TXT',' Y3pc:%.0f',Y3pc);//輸出Y3pc
end
if kc>0 then begin
buy(1,kc,limitr,max(o,hi+0.2)+0.6);
Y3kc:1,linethick0;
if islastbar then
DEBUGFILE('E:\TEST.TXT',' Y3kc:%.0f',Y3kc);//輸出Y3kc
end
cc:=1;
end
if cc=0 and PDKK then begin
Y4:cc=0 and PDKK ,linethick0;
if islastbar then
DEBUGFILE('E:\TEST.TXT',' Y4:%.0f',Y4);//輸出Y4
pc:=min(max(holding,0),SS);
kc:=SS-pc;
if pc>0 then begin
sell(1=1,pc,limitr,min(o,lo-0.2)-0.6);
Y4pc:1,linethick0;
if islastbar then
DEBUGFILE('E:\TEST.TXT',' Y4pc:%.0f',Y4pc);//輸出Y4pc
end
if kc>0 then begin
buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
Y4kc:1,linethick0;
if islastbar then
DEBUGFILE('E:\TEST.TXT',' Y4kc:%.0f',Y4kc);//輸出Y4kc
end
cc:=-1;
end
if time=closetime(0) then begin
cc:=0;
end
持倉(cāng):holding,linethick0;
資產(chǎn):asset,noaxis;
可用現(xiàn)金:cash(0),linethick0;