請問小幫手,下述腳本是多單的停損停利,如要改成多單跟空單都可適用的停損停利腳本,該如何修改?
再麻煩小幫手,研究許久,還是不太懂.
{多單停損停利(%)}
input: profit_percent(1, "停利(%)");
input: loss_percent(1, "停損(%)");
if Position = 1 and Filled = 1 then begin
{ 依照成本價格設定停損/停利 }
if profit_percent > 0 and Close >= FilledAvgPrice*(1+0.01*profit_percent) then begin
{ 停利 }
SetPosition(0);
end else if loss_percent > 0 and Close <= FilledAvgPrice*(1-0.01*loss_percent) then begin
{ 停損 }
SetPosition(0);
end;
end;
2 評論