各位好
我的設定是60k的交易頻率,是否是因為設定自動洗價,導致每分鐘都有進出,造成大額的虧損?
另外我有設定:每一根60k最多交易4次就出清倉位並停止策略,但似乎沒發揮作用?是否可以給我一些建議,謝謝。
if GetInfo("TradeMode") = 1 and Position = 0 and CurrentBar > last_trade_bar and hourly_trade_count < 4 then begin
if short_condition or ((Time = 084500 or Time = 150000) and short_condition[1] and Time <> last_check_time) then begin
SetPosition(-1);
if Filled = -1 then begin
EntryPriceAvg = FilledAvgPrice; // 使用成交價
end else begin
EntryPriceAvg = Close; // 若未成交,暫用收盤價
Print("Warning: Short entry at ", Time, " no fill, using Close: ", Close);
end;
last_trade_bar = CurrentBar;
hourly_trade_count = hourly_trade_count + 1;
last_check_time = Time;
Print("Short entry at ", Time, " Price: ", EntryPriceAvg, " Trade count: ", hourly_trade_count, " Position: ", Position, " Filled: ", Filled);
end;
end else if hourly_trade_count >= 4 then begin
SetPosition(0); // 出清倉位
RaiseRunTimeError("One-hour trade count reaches 4, clearing position and stopping strategy");
end;
9 評論