From bc250a591c4ec250c33c28d6bbfa8df0ec09f2be Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 6 May 2025 21:06:52 +0200 Subject: [PATCH] refactor(qav3): cleanup confirm_trade_entry() 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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/quickadapter/user_data/strategies/QuickAdapterV3.py b/quickadapter/user_data/strategies/QuickAdapterV3.py index 60589c5..8832199 100644 --- a/quickadapter/user_data/strategies/QuickAdapterV3.py +++ b/quickadapter/user_data/strategies/QuickAdapterV3.py @@ -644,12 +644,13 @@ class QuickAdapterV3(IStrategy): if isna(last_candle_natr): return False entry_natr_ratio = self.get_entry_natr_ratio(pair) + price_deviation = last_candle_natr * entry_natr_ratio if side == "long": - lower_bound = last_candle_low * (1 - last_candle_natr * entry_natr_ratio) - upper_bound = last_candle_close * (1 + last_candle_natr * entry_natr_ratio) + lower_bound = last_candle_low * (1 - price_deviation) + upper_bound = last_candle_close * (1 + price_deviation) elif side == "short": - lower_bound = last_candle_close * (1 - last_candle_natr * entry_natr_ratio) - upper_bound = last_candle_high * (1 + last_candle_natr * entry_natr_ratio) + lower_bound = last_candle_close * (1 - price_deviation) + upper_bound = last_candle_high * (1 + price_deviation) if lower_bound < 0: logger.info( f"User denied {side} entry for {pair}: calculated lower bound {lower_bound} is below zero" -- 2.43.0