cu1:='cu00';
CUKD:=;
CUPD:=;
CUKK:=;
CUPK:=;
tbuy(CUKD and tbuyholdingex('',cu1,1)<1,10,mkt,0,0,'',cu1);
tbuyshort(CUKK and tsellholdingex('',cu1,1)<1,10,mkt,0,0,'',cu1);
tsell(CUPD and tbuyholdingex('',cu1,1)>0,0,mkt,0,0,'',cu1);
tsellshort(CUPD and tsellholdingex('',cu1,1)>0,0,mkt,0,0,'',cu1);
if (hhv(topenprofit,tenterbars+1)-topenprofit)/hhv(topenprofit,tenterbars+1)>=0.2 and tbuyholdingex('',cu1,1)>0 then begin
tsell(1,tbuyholdingex('',cu1,1),mkt,0,0,'',cu1);
end
if (hhv(topenprofit,tenterbars+1)-topenprofit)/hhv(topenprofit,tenterbars+1)>=0.2 and tsellholdingex('',cu1,1)>0 then begin
tsellshort(1,tsellholdingex('',cu1,1),mkt,0,0,'',cu1);
end
if tavgenterpriceex2('',cu1,0)-c>200*mindiff then begin
tsell(1,tbuyholdingex('',cu1,1),mkt,0,0,'',cu1);
end
if c-tavgenterpriceex2('',cu1,0)>200*mindiff then begin
tsellshort(1,tsellholdingex('',cu1,1),mkt,0,0,'',cu1);
end
WCJ:=tremainqty(0,'',cu1);
if WCJ<>0 then begin
A:=WCJ;
end
if WCJ>0 then begin
tcancelex(1,0,'',cu1);
tbuy(WCJ=0,A,mkt,0,0,'',cu1);
tbuyshort(WCJ=0,A,mkt,0,0,'',cu1);
end
当前持仓量:=tbuyholdingex('',cu1,1)+tsellholdingex('',cu1,1);
当前可用资金:=taccount(19);
debugout('当前持仓量%.2f',当前持仓量 );
debugout('当前可用资金%.2f',当前可用资金 );