if Position = 0
and ha_c > ha_ma5
and Time >= 084500 and Time <= 134500 then begin // (若此段時間若改成夜盤 Time >= 150000 and Time <= 050000 )
SetPosition(1, MARKET);
entry_price = Close;
stoploss_price = Close - loss_point;
stoploss_point = FilledAvgPrice - loss_point;
max_profit_point = 0;
in_trade = true;
if Position = 1 and Time >= 133500 // ( 改成Time >= 044500 回測後會看到夜盤買進的單都出現於跨日的13:45平倉,會跨日平倉且平倉日於隔日早盤的收盤點),(若夜盤交易時間寫成不跨日 Time >= 130000 and Time <= 23550000 then begin 之前 ,程式碼試寫於Time >=235000,強制平倉就會正確於235500 正確平倉出場)
SetPosition(0);
stoploss_point = 0;
max_profit_point = 0;
in_trade = false;
end;
請問我碰到這個問題該使用什麼邏輯條件來寫程式碼 ,才不會有跨到隔日早盤才平倉的狀況發生. 請回覆解答謝謝
3 評論