為什麼我的自動交易程式無法出清今天以前購入的持股?? 我的程式BUG在哪裡?
以下是我的程式:
var: idx(0),cnt(0);
if position <> 0 and filled <> 0 then
begin
cnt=filledRecordCount;
for idx=1 to cnt
begin
Value1 = FilledRecordDate(idx);
Value2 = dateDiff(Date,Value1);
//購入至今已有多少天0,1,2,3,....
if Value2 <>0 then SetPosition(0,Market);
//如果不是今天購入的股票, 就出清手中持股
idx+=1;
end;
end;
7 評論