]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
fix(qav3): properly adapt slope strength min/max to log space
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 19 May 2025 00:30:02 +0000 (02:30 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 19 May 2025 00:30:02 +0000 (02:30 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/QuickAdapterV3.py
quickadapter/user_data/strategies/Utils.py

index dd79c6b0dade773b211e1ae95c1263dd85743e6e..ba3d4a534529405687385835f46cbd314efeaeb7 100644 (file)
@@ -45,7 +45,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
     https://github.com/sponsors/robcaulk
     """
 
-    version = "3.7.41"
+    version = "3.7.42"
 
     @cached_property
     def _optuna_config(self) -> dict:
@@ -932,8 +932,8 @@ def zigzag(
     def calculate_min_slope_strength(
         pos: int,
         lookback_period: int = 20,
-        min_value: float = 0.03,
-        max_value: float = 0.07,
+        min_value: float = 0.5,
+        max_value: float = 1.5,
     ) -> float:
         start = max(0, pos - lookback_period)
         end = min(pos + 1, n)
@@ -980,7 +980,6 @@ def zigzag(
         next_confirmation_pos: int,
         direction: TrendDirection,
         extrema_threshold: float = 0.85,
-        min_slope_volatility: float = 0.0095,
         move_away_ratio: float = 0.25,
     ) -> bool:
         next_start = next_confirmation_pos + 1
@@ -1024,9 +1023,9 @@ def zigzag(
             return False
 
         slope_ok = False
-        log_next_closes = np.log(next_closes)
-        log_next_closes_std = np.std(log_next_closes)
-        if len(next_closes) >= 2 and log_next_closes_std > min_slope_volatility:
+        if len(next_closes) >= 2:
+            log_next_closes = np.log(next_closes)
+            log_next_closes_std = np.std(log_next_closes)
             weights = np.linspace(0.5, 1.5, len(log_next_closes))
             log_next_slope = np.polyfit(
                 range(len(log_next_closes)), log_next_closes, 1, w=weights
index 2387ea7305f53724ccaa49f712535749fcddb756..d86d17e9d91957b108e3353ec6006d6bb33b607f 100644 (file)
@@ -58,7 +58,7 @@ class QuickAdapterV3(IStrategy):
     INTERFACE_VERSION = 3
 
     def version(self) -> str:
-        return "3.3.38"
+        return "3.3.39"
 
     timeframe = "5m"
 
index 3e0d417937a8be7fd4bf5ba83ffefb463e70da67..440edcd266760df744feffc923858bb28244b223 100644 (file)
@@ -429,8 +429,8 @@ def zigzag(
     def calculate_min_slope_strength(
         pos: int,
         lookback_period: int = 20,
-        min_value: float = 0.03,
-        max_value: float = 0.07,
+        min_value: float = 0.5,
+        max_value: float = 1.5,
     ) -> float:
         start = max(0, pos - lookback_period)
         end = min(pos + 1, n)
@@ -477,7 +477,6 @@ def zigzag(
         next_confirmation_pos: int,
         direction: TrendDirection,
         extrema_threshold: float = 0.85,
-        min_slope_volatility: float = 0.0095,
         move_away_ratio: float = 0.25,
     ) -> bool:
         next_start = next_confirmation_pos + 1
@@ -521,9 +520,9 @@ def zigzag(
             return False
 
         slope_ok = False
-        log_next_closes = np.log(next_closes)
-        log_next_closes_std = np.std(log_next_closes)
-        if len(next_closes) >= 2 and log_next_closes_std > min_slope_volatility:
+        if len(next_closes) >= 2:
+            log_next_closes = np.log(next_closes)
+            log_next_closes_std = np.std(log_next_closes)
             weights = np.linspace(0.5, 1.5, len(log_next_closes))
             log_next_slope = np.polyfit(
                 range(len(log_next_closes)), log_next_closes, 1, w=weights