請問我在下方的語法去掃我的自選股時有成功掃到並讓每一筆符合entry_condition條件的單都買進了。
但卻不會在後面的停損停利點出場... 請問是否語法有問題呢?
(我想要成交價達1.5%時就停利出場或在小於某價位loss_P或前日收盤價prv_close時停損出場)
if position = 0 and entry_condition then begin
SetPosition(1, MARKET);
end;
if position = 1 then begin
if profit_percent > 0 and q_last >= FilledAvgPrice*(1+0.01*profit_percent) then begin
SetPosition(0);
{end else if loss_P > 0 and q_last < loss_P and Close < prv_close then begin
SetPosition(0);}
end;
end;
1 評論