From: Jérôme Benoit Date: Wed, 24 Dec 2025 12:36:53 +0000 (+0100) Subject: fix(quickadapter): render zero-weight extrema bars X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=eb4144f8a77addda5edfa9b169b7747c5f9f0916;p=freqai-strategies.git fix(quickadapter): render zero-weight extrema bars --- diff --git a/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py b/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py index dbb406b..76a350f 100644 --- a/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py +++ b/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py @@ -72,7 +72,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel): https://github.com/sponsors/robcaulk """ - version = "3.7.137" + version = "3.7.138" _TEST_SIZE: Final[float] = 0.1 diff --git a/quickadapter/user_data/strategies/QuickAdapterV3.py b/quickadapter/user_data/strategies/QuickAdapterV3.py index 8cd085d..4fb8d9a 100644 --- a/quickadapter/user_data/strategies/QuickAdapterV3.py +++ b/quickadapter/user_data/strategies/QuickAdapterV3.py @@ -107,7 +107,7 @@ class QuickAdapterV3(IStrategy): _TRADING_MODES: Final[tuple[TradingMode, ...]] = ("spot", "margin", "futures") def version(self) -> str: - return "3.3.187" + return "3.3.188" timeframe = "5m" @@ -146,6 +146,8 @@ class QuickAdapterV3(IStrategy): _ANNOTATION_LINE_OFFSET_CANDLES: Final[int] = 10 + _PLOT_EXTREMA_ZERO_EPS: Final[float] = 0.025 + timeframe_minutes = timeframe_to_minutes(timeframe) minimal_roi = {str(timeframe_minutes * 864): -1} @@ -1110,8 +1112,10 @@ class QuickAdapterV3(IStrategy): ) dataframe.loc[pivots_indices, EXTREMA_COLUMN] = pivots_directions + extrema_direction = dataframe[EXTREMA_COLUMN] + weighted_extrema, _ = get_weighted_extrema( - extrema=dataframe[EXTREMA_COLUMN], + extrema=extrema_direction, indices=pivots_indices, amplitudes=pivots_amplitudes, amplitude_threshold_ratios=pivots_amplitude_threshold_ratios, @@ -1136,8 +1140,17 @@ class QuickAdapterV3(IStrategy): gamma=self.extrema_weighting["gamma"], ) - dataframe["minima"] = weighted_extrema.clip(upper=0.0) - dataframe["maxima"] = weighted_extrema.clip(lower=0.0) + plot_eps = QuickAdapterV3._PLOT_EXTREMA_ZERO_EPS + dataframe["maxima"] = ( + weighted_extrema.where(extrema_direction.gt(0), 0.0) + .clip(lower=0.0) + .mask(extrema_direction.gt(0) & weighted_extrema.eq(0.0), plot_eps) + ) + dataframe["minima"] = ( + weighted_extrema.where(extrema_direction.lt(0), 0.0) + .clip(upper=0.0) + .mask(extrema_direction.lt(0) & weighted_extrema.eq(0.0), -plot_eps) + ) dataframe[EXTREMA_COLUMN] = smooth_extrema( weighted_extrema,