加仓达到2次以后, 只允许止损退出

This commit is contained in:
zhangkun9038@dingtalk.com 2025-08-22 22:55:26 +08:00
parent c9677546e1
commit f0b283d8d2

View File

@ -1589,6 +1589,10 @@ class FreqaiPrimer(IStrategy):
def custom_exit_price(self, pair: str, trade: Trade,
current_time: datetime, proposed_rate: float,
current_profit: float, exit_tag: str | None, **kwargs) -> float:
if trade.entry_side_count >= 2:
# 当加仓次数 >= 2 时,只允许止损退出
# 止损逻辑由Freqtrade自动处理无需显式检查
return None # 禁用其他退出信号
adjusted_rate = proposed_rate * (1 + 0.0025)
logger.info(f"[{pair}] 自定义卖出价:{adjusted_rate:.6f}(原价:{proposed_rate:.6f}")
return adjusted_rate