還是一樣出清無法抓取高點問題

  •   37 
  • 最後發表   賢仔  2025 九月 16
賢仔 發文於   2025/09/11

小編 教授 您好

ㄧ下是我的出清策略.可是我還是無法在當前K急拉後出現上影線抓取ㄍ高點.導致下一根K沒處發出清.以下是我出清腳本

再麻煩幫我看一下.謝謝

// === 停損 / 移動停利邏輯 ===

If Position <> 0 and IsFilled = True and (CurrentTimeVar - ppTime > 3) then begin

    if Position > 0 then begin

        TickLossPrice = AddSpread(MyEntryPrice, -TickLoss);

 

        if Close <= TickLossPrice then begin

            IsFilled = False;

            SetPosition(0);

            {Print("多單停損出清");}

        end

        else if UseTrailingStop then begin

            max_profit_price = MaxList(max_profit_price, High);

            valuee1 = AddSpread(MyEntryPrice, MoveProfitStartTicks);

 

            if high >= valuee1 then

                TrailingStopPrice = AddSpread(max_profit_price, -TrailingStopTicks);

 

            if Close <= TrailingStopPrice and Close >= valuee1 then begin

                IsFilled = False;

                SetPosition(0);

                {Print("多單移動停利出清);}

            end;

        end;

 

    end

排序方式: 標準 | 最新
虎科大許教授 發文於   2025/09/11

(1)你可能需要釐清並詳述你的問題。當前K急拉後出現上影線,一定是下一根K棒才知道。你要用[1]抓前一根K棒有上影線,至於急拉,需要自己定義,並用程式描述。

(2)變數的定義方式攸關邏輯是否正確。你並沒有揭露變數如何宣告。

(3)試著學習用print印出過程中變數的數值變化,這樣比較容易發現問題所在。

XS小編 發文於   2025/09/16

Hello 賢仔,

 

小編補充,如果要作 移動停損/移動停利 的話,可參考系統內建的交易腳本。

另外,要取得K棒的上影線的話,可以用 high - maxlist(open, close) 來計算。

發表回覆
Close