可以用全局变量来记录下了多少手单,但是这个可能因为不成交或者撤单之类的问题导致数值不正确,比如用这个方法
if 开多条件 and 持仓判断 then begin
tbuy........;
extgbdataset('duocang',extgbdata(duocang)+n);
end
if 开空条件 and 持仓判断 then begin
tbuyshort........;
extgbdataset('kongcang',extgbdata(kongcang)+n);
end
if 平多条件 and 持仓判断 then begin
tsell........;
extgbdataset('duocang',extgbdata(duocang)-n);
end
if 平空条件 and 持仓判断 then begin
tbuyshort........;
extgbdataset('kongcang',extgbdata(kongcang)-n);
end
if time=closetime(0) then begin
extgbdataset('duocang',0);
extgbdataset('kongcang',0);
end
n是你开仓时的下单数量
最后平仓的手数多是:extgbdata('duocang')
空仓:extgbdata('kongcang')
if 开多条件 and 持仓判断 then begin
tbuy........;
TOTAL_BVOL= TOTAL_BVOL+1;
end
f 开多条件 and 持仓判断 then begin
tbuy........;
extgbdataset('duocang',extgbdata(duocang)+n); 红色字不需要在里面加上 单引号吗?改成extgbdata(‘duocang’)+n