小編你好!
以下出場腳本,在實測時發現停損出場條件不會觸發,不知道能否指導一下該如何修改? 謝謝!!
//出場
if Filled <0 then begin
if CurrentTime>=CloseTime then begin
SetPosition(0); { 時間出場 }
end else
{ 依照成本價格設定停損/停利: 請注意當作空時, 判斷是否獲利的方向要改變 }
if Close>=minList(FilledAvgPrice*(1+(0.01*SL)),CloseD(1)*(1+ (UPSL*0.01))) then begin
SetPosition(0); { 停損出場 }
if FilledRecordCount>=1 and filled=0 then RaiseRunTimeError("已執行出場完成,中止策略") ;
end else
if close>FilledAvgPrice and Position<>Filled then cancelAllOrders
else
setposition(0,maxList(Getfield("參考價", "D")*0.915,FilledAvgPrice*(1-(0.01*PT))));{預掛停利出場 };
end;
5 評論