//多單停損(%)
input: profit_percent(3.5, "停利(%)");
input: loss_percent(0.9, "停損(%)");
if Filled > 0 then begin
{ 依照成本價格設定停損/停利 }
if profit_percent > 0 and
Close >= FilledAvgPrice*(1+0.01*profit_percent) then begin
{ 停利 }
SetPosition(0, label:="停利出場");
end else if loss_percent > 0 and
Close <= FilledAvgPrice*(1-0.01*loss_percent) then begin
{ 停損 }
SetPosition(0, label:="停損出場");
end;
end;
//空單停損(%)
if Filled < 0 then begin
{ 依照成本價格設定停損/停利 }
if profit_percent > 0 and
Close <= FilledAvgPrice*(1-0.01*profit_percent) then begin
{ 停利 }
SetPosition(0, label:="停利出場");
end else if loss_percent > 0 and
Close >= FilledAvgPrice*(1+0.01*loss_percent) then begin
{ 停損 }
SetPosition(0, label:="停損出場");
end;
end;
教授 我是做空的,有以下幾個問題,
1. 我現在的策略停損出場,的賣出價格是多少? 是否為市價?
2. 假如急拉漲停時,委託單是依市價送出,但是無成交,系統後續會怎麼處理?
3. 假如急拉漲停時,是否可以直接設定漲停價買回? 程式碼要如何改?
感謝有您
5 評論