以下是當沖交易腳本,回測3450聯鈞 2024-01-01~2024-12-31,在2024-02-16 10:47 應該會停損出場,腳本中也有要在13:24時出場,但兩者皆沒有觸發出場,請問腳本哪裡錯了?



vars: entry_price(0);
if
Position = 0 and
time = 090000 and
open > getfield("close", "D")[1]
then begin
SetPosition(-1, close, label:="entry");
entry_price = close;
end;
//停利
if Position = -1 and low <= (entry_price * 0.98)
then begin
SetPosition(0, entry_price * 0.98, label:="停利");
end;
//停損
if Position = -1 and high >= (entry_price * 1.02)
then begin
SetPosition(0, entry_price * 1.02, label:="停損");
end;
// 收盤強制平倉
if Position = -1 and Time = 132400
then
SetPosition(0, MARKET, label:="收盤");
2 評論