小編你好
不知道XS 自動交易語法裡有無超過停損點時馬上同樣金額或同樣張數的換手方向的寫法
換手後仍能執行停損或停利 嘗試了好幾種寫法 始終無法達到預期效果
以下個人寫出的語法是依庫存方式執行的 懇請小幫手賜教
input: profit_percent(15, "停利(%)");
input: loss_percent(7, "停損(%)");
if Position >= 1 then begin
if close >= FilledAvgPrice*(1+0.01*profit_percent) then begin
{ 停利 }
SetPosition(0);
end else if close <= FilledAvgPrice*(1-0.01*loss_percent) then begin
{ 停損 }
SetPosition(0);
end;
end;
if Position <= -1 then begin
if close <= FilledAvgPrice*(1-0.01*profit_percent) then begin
{ 停利 }
SetPosition(0);
end else if close >= FilledAvgPrice*(1+0.01*loss_percent) then begin
{ 停損 }
SetPosition(0);
end;
end;
5 評論