From df06fa81dc92f745084047f6af95d1d0798ba61a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 24 Dec 2025 14:26:45 +0100 Subject: [PATCH] refactor(quickadapter): dynamically adjust extrema plot epsilon for zero weighted extrema values MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- quickadapter/user_data/strategies/QuickAdapterV3.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/quickadapter/user_data/strategies/QuickAdapterV3.py b/quickadapter/user_data/strategies/QuickAdapterV3.py index 4fb8d9a..ea9b7c5 100644 --- a/quickadapter/user_data/strategies/QuickAdapterV3.py +++ b/quickadapter/user_data/strategies/QuickAdapterV3.py @@ -146,9 +146,10 @@ class QuickAdapterV3(IStrategy): _ANNOTATION_LINE_OFFSET_CANDLES: Final[int] = 10 - _PLOT_EXTREMA_ZERO_EPS: Final[float] = 0.025 + _PLOT_EXTREMA_MIN_EPS: Final[float] = 0.01 timeframe_minutes = timeframe_to_minutes(timeframe) + minimal_roi = {str(timeframe_minutes * 864): -1} # FreqAI is crashing if minimal_roi is a property @@ -1140,7 +1141,10 @@ class QuickAdapterV3(IStrategy): gamma=self.extrema_weighting["gamma"], ) - plot_eps = QuickAdapterV3._PLOT_EXTREMA_ZERO_EPS + plot_eps = weighted_extrema.abs().where(weighted_extrema.ne(0.0)).min() + if not np.isfinite(plot_eps): + plot_eps = 0.0 + plot_eps = max(float(plot_eps) * 0.5, QuickAdapterV3._PLOT_EXTREMA_MIN_EPS) dataframe["maxima"] = ( weighted_extrema.where(extrema_direction.gt(0), 0.0) .clip(lower=0.0) -- 2.53.0