]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
refactor(qav3): cleanup confirm_trade_entry()
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 6 May 2025 19:06:52 +0000 (21:06 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 6 May 2025 19:06:52 +0000 (21:06 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/strategies/QuickAdapterV3.py

index 60589c5681119d2cad0dcc28f2935deb3d6e4bdf..88321999863297797cccb641c42e5ee28bc533d0 100644 (file)
@@ -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"