From b3b3bf6c1d981bf427ee9bb326a2e1c8dd762e15 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 25 May 2025 08:53:37 +0200 Subject: [PATCH] feat: allow break-even (0.0) as valid return from custom_roi --- freqtrade/strategy/interface.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 51a89cf8c..f4a2b38c6 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -1681,6 +1681,7 @@ class IStrategy(ABC, HyperStrategyMixin): """ # Get custom ROI if use_custom_roi is set to True + custom_roi = None if self.use_custom_roi: custom_roi = strategy_safe_wrapper( self.custom_roi, default_retval=None, supress_error=True @@ -1692,11 +1693,9 @@ class IStrategy(ABC, HyperStrategyMixin): entry_tag=trade.enter_tag, side=trade.trade_direction, ) - if not custom_roi or isnan(custom_roi) or isinf(custom_roi): + if custom_roi is None or isnan(custom_roi) or isinf(custom_roi): custom_roi = None logger.debug(f"Custom ROI function did not return a valid ROI for {trade.pair}") - else: - custom_roi = None # Get highest entry in ROI dict where key <= trade-duration roi_list = [x for x in self.minimal_roi.keys() if x <= trade_dur]