您好,
我的寫法和預設情境一直不符,請教您正確的寫法,謝謝!
我有兩個進場條件create1和create2,想一天內,符合這兩個其一情況下,就short一次,最多一天short 兩次,我用了countshort來控制次數,但出現結果仍然在一天內超過2次以上的進場。
var:countshort(0);
countshort = 0;
if create1 and countshort < 2 then begin
short(1);
countshort += 1;
end;
if create2 and countshort < 2 then begin
short(1);
countshort += 1;
end;
if EnterMarketCloseTime(2) then setposition(0);
我有其他策略會在某些情況下出場,所以filledrecordcount或filled或position不太適用。麻煩針對用變數計算次數這部分教教我,感謝!
2 評論