]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
fix(qav3): fix take profit distance computation
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 21 Apr 2025 11:37:47 +0000 (13:37 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 21 Apr 2025 11:37:47 +0000 (13:37 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/strategies/QuickAdapterV3.py

index 3b4f6e21858b6f5dc6559fff7fca45b8adcb99b7..67a9f3801ecbaa2fa3b1c17a8683ff6b5ccfeb06 100644 (file)
@@ -58,7 +58,7 @@ class QuickAdapterV3(IStrategy):
     INTERFACE_VERSION = 3
 
     def version(self) -> str:
-        return "3.3.10"
+        return "3.3.11"
 
     timeframe = "5m"
 
@@ -522,18 +522,16 @@ class QuickAdapterV3(IStrategy):
         trade_take_profit_distance = (
             trade.open_rate * entry_natr * self.get_take_profit_natr_ratio(trade.pair)
         )
-        return max(
-            trade_take_profit_distance,
-            np.median(
-                [
-                    trade_take_profit_distance,
-                    current_rate
-                    * current_natr
-                    * self.get_take_profit_natr_ratio(trade.pair),
-                ]
+        current_take_profit_distance = (
+            current_rate * current_natr * self.get_take_profit_natr_ratio(trade.pair)
+        )
+        return (
+            max(
+                trade_take_profit_distance,
+                np.median([trade_take_profit_distance, current_take_profit_distance]),
             )
             * math.log10(9 + trade_duration_candles)
-            * self.reward_risk_ratio,
+            * self.reward_risk_ratio
         )
 
     def custom_stoploss(