可以用全局變量來(lái)記錄下了多少手單,但是這個(gè)可能因?yàn)椴怀山换蛘叱穯沃?lèi)的問(wèn)題導(dǎo)致數(shù)值不正確,比如用這個(gè)方法
if 開(kāi)多條件 and 持倉(cāng)判斷 then begin
tbuy........;
extgbdataset('duocang',extgbdata(duocang)+n);
end
if 開(kāi)空條件 and 持倉(cāng)判斷 then begin
tbuyshort........;
extgbdataset('kongcang',extgbdata(kongcang)+n);
end
if 平多條件 and 持倉(cāng)判斷 then begin
tsell........;
extgbdataset('duocang',extgbdata(duocang)-n);
end
if 平空條件 and 持倉(cāng)判斷 then begin
tbuyshort........;
extgbdataset('kongcang',extgbdata(kongcang)-n);
end
if time=closetime(0) then begin
extgbdataset('duocang',0);
extgbdataset('kongcang',0);
end
n是你開(kāi)倉(cāng)時(shí)的下單數(shù)量
最后平倉(cāng)的手?jǐn)?shù)多是:extgbdata('duocang')
空倉(cāng):extgbdata('kongcang')