From 3610c92213dae6aee851cfddcc46307b5e5d16fc Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 18 May 2025 06:43:22 +0200 Subject: [PATCH] refactor(qav3): cleanup conditions 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 | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/quickadapter/user_data/strategies/QuickAdapterV3.py b/quickadapter/user_data/strategies/QuickAdapterV3.py index f16014f..ffbcc94 100644 --- a/quickadapter/user_data/strategies/QuickAdapterV3.py +++ b/quickadapter/user_data/strategies/QuickAdapterV3.py @@ -513,7 +513,8 @@ class QuickAdapterV3(IStrategy): current_natr_weight = 0.5 natr_pct_change = abs(current_natr - entry_natr) / entry_natr natr_pct_change_thresholds = [ - (0.8, 0.4), # (threshold, adjustment) + (1.0, 0.5), # (threshold, adjustment) + (0.8, 0.4), (0.6, 0.3), (0.4, 0.2), (0.2, 0.1), @@ -557,9 +558,7 @@ class QuickAdapterV3(IStrategy): return None stoploss_distance = self.get_stoploss_distance(df, trade, current_rate) - if isna(stoploss_distance): - return None - if stoploss_distance <= 0: + if isna(stoploss_distance) or stoploss_distance <= 0: return None sign = 1 if trade.is_short else -1 return stoploss_from_absolute( @@ -605,9 +604,7 @@ class QuickAdapterV3(IStrategy): return "maxima_detected_long" take_profit_distance = self.get_take_profit_distance(df, trade) - if isna(take_profit_distance): - return None - if take_profit_distance <= 0: + if isna(take_profit_distance) or take_profit_distance <= 0: return None take_profit_price = ( trade.open_rate + (-1 if trade.is_short else 1) * take_profit_distance -- 2.43.0