From 30b32a0d2ea5ced730c298ff397dfdc2036f6b32 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 17 Jul 2025 06:53:50 +0200 Subject: [PATCH] fix: don't call stoploss-adjust after trade has closed closes #11990 --- freqtrade/freqtradebot.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 811f1735d..077b5bdbd 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -2363,14 +2363,14 @@ class FreqtradeBot(LoggingMixin): stake_currency=self.config["stake_currency"], dry_run=self.config["dry_run"], ) - if self.strategy.use_custom_stoploss: - current_rate = self.exchange.get_rate( - trade.pair, side="exit", is_short=trade.is_short, refresh=True - ) - profit = trade.calc_profit_ratio(current_rate) - self.strategy.ft_stoploss_adjust( - current_rate, trade, datetime.now(UTC), profit, 0, after_fill=True - ) + if self.strategy.use_custom_stoploss and trade.is_open: + current_rate = self.exchange.get_rate( + trade.pair, side="exit", is_short=trade.is_short, refresh=True + ) + profit = trade.calc_profit_ratio(current_rate) + self.strategy.ft_stoploss_adjust( + current_rate, trade, datetime.now(UTC), profit, 0, after_fill=True + ) # Updating wallets when order is closed self.wallets.update() return trade