想請問這個程式碼 該修正哪裡...無法編譯 想請益各位

  •   182 
  • 最後發表   sean06  2025 四月 05
sean06 發文於   2025/04/04

variable: intrabarpersist position_1(0);

variable: intrabarpersist entry_price(0);

variable: intrabarpersist stop_loss(0);

variable: intrabarpersist take_profit(0);

 

condition1 = close crosses above average(close, 7);

condition2 = close crosses below average(close, 7);

stop_loss_level = entry_price * 0.95; // Example: 5% stop-loss

take_profit_level = entry_price * 1.10; // Example: 10% take-profit

 

if position_1 == 0 then

begin

    if condition1 then

    begin

        position_1 = 1;

        entry_price = close;

        stop_loss = stop_loss_level;

        take_profit = take_profit_level;

        // ... (rest of the entry logic)

    end;

end

else

begin

    if condition2 or close <= stop_loss or close >= take_profit then

    begin

        position_1 = 0;

        entry_price = 0;

        stop_loss = 0;

        take_profit = 0;

        // ... (rest of the exit logic)

    end;

end;

 

虎科大許教授 發文於   2025/04/05

(1) if position_1 == 0 then 改成 if position_1 = 0 then

(2) stop_loss_level 變數沒有宣告。

(3) take_profit_level 變數沒有宣告。

 

發表回覆
Close