drawtextex(1,1,800,0,'虚拟持仓为:'+numtostr(cc612799,0));//在图表上输入虚拟持仓以便监控
if not(islastbar) or workmode<>1 then exit;
xiadan612799:=cc612799-hold;
if xiadan612799>0.5 then begin
cang:=min(xiadan612799,abs(hold));
if hold<0 then begin
tsellshort(1,cang,mkt,0,0,'612799'),allowrepeat;
debugfile('D:\612799.txt',numtostr(hold,0)+' '+numtostr(cc612799,0)+' 平空 %.0f',cang);
end
cang:=xiadan612799+min(hold,0);
if cang>0 then begin
tbuy(1,cang,mkt,0,0,'612799'),allowrepeat;
debugfile('D:\612799.txt',numtostr(hold,0)+' '+numtostr(cc612799,0)+' 开多 %.0f',cang);
end
end
if xiadan612799<-0.5 then begin
cang:=min(abs(xiadan612799),abs(hold));
if hold>0 then begin
tsell(1,cang,mkt,0,0,'612799'),allowrepeat;
debugfile('D:\612799.txt',numtostr(hold,0)+' '+numtostr(cc612799,0)+' 平多 %.0f',cang);
end
cang:=abs(xiadan612799)-max(hold,0);
if cang>0 then begin
tbuyshort(1,cang,mkt,0,0,'612799'),allowrepeat;
debugfile('D:\612799.txt',numtostr(hold,0)+' '+numtostr(cc612799,0)+' 开空 %.0f',cang);
end
end
hold:=cc612799;