小編,教授 您好
請問一下我目前遇到一個問題就是沒辦法再當前K進場後拉升上影線,沒計算出清問題。是否可以幫我解答,謝謝您 附上照片固定停利是1%
以下是出清出清程式碼
// === 出場邏輯(固定停利 / 停損)===
If Position <> 0 and IsFilled = True and (CurrentTimeVar - ppTime > 8) then begin
// 多單
if Position = 1 then begin
if high >= MyEntryPrice * (1 + FixedProfitPercent / 100) then begin
Print("? 多單觸發【固定停利】出場!", Close);
IsFilled = False;
SetPosition(0);
end
else if Close <= MyEntryPrice * (1 - FixedLossPercent / 100) then begin
Print("? 多單觸發【固定停損】出場!", Close);
IsFilled = False;
SetPosition(0);
end;
end;
// 空單
if Position = -1 then begin
if low <= MyEntryPrice * (1 - FixedProfitPercent / 100) then begin
Print("? 空單觸發【固定停利】出場!", Close);
IsFilled = False;
SetPosition(0);
end
else if Close >= MyEntryPrice * (1 + FixedLossPercent / 100) then begin
Print("? 空單觸發【固定停損】出場!", Close);
IsFilled = False;
SetPosition(0);
end;
4 評論