]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
refactor(qav3): cleanup zigzag()
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 2 May 2025 21:00:10 +0000 (23:00 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 2 May 2025 21:00:10 +0000 (23:00 +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 e5c5f378ef8b5d44ddc856544679e4e8c20db5d4..5d7bab1538d1fab6516a9029a41f494d9c39dca2 100644 (file)
@@ -958,26 +958,6 @@ def zigzag(
                 add_pivot(i, highs[i], TrendDirection.UP)
                 state = TrendDirection.UP
 
-    final_pos = len(df) - 1
-    last_pivot_val = pivots_values[-1]
-    if state == TrendDirection.UP:
-        if (
-            (last_pivot_val - lows[final_pos]) / last_pivot_val >= thresholds[final_pos]
-            and (final_pos - last_pivot_pos) >= depth
-            and is_fractal_low[final_pos]
-            and indices[final_pos] != pivots_indices[-1]
-        ):
-            add_pivot(final_pos, lows[final_pos], TrendDirection.DOWN)
-    elif state == TrendDirection.DOWN:
-        if (
-            (highs[final_pos] - last_pivot_val) / last_pivot_val
-            >= thresholds[final_pos]
-            and (final_pos - last_pivot_pos) >= depth
-            and is_fractal_high[final_pos]
-            and indices[final_pos] != pivots_indices[-1]
-        ):
-            add_pivot(final_pos, highs[final_pos], TrendDirection.UP)
-
     return pivots_indices, pivots_values, pivots_directions
 
 
index 43aef1f6fd654158b80a24ad9018ae67bb701fdd..fb3140b80594ec5e2e13065a59e9402f7f853469 100644 (file)
@@ -369,10 +369,10 @@ class QuickAdapterV3(IStrategy):
         return self.get_label_natr_ratio(pair) * 0.015
 
     def get_stoploss_natr_ratio(self, pair: str) -> float:
-        return self.get_label_natr_ratio(pair) * 0.65
+        return self.get_label_natr_ratio(pair) * 0.675
 
     def get_take_profit_natr_ratio(self, pair: str) -> float:
-        return self.get_stoploss_natr_ratio(pair) * 0.825
+        return self.get_stoploss_natr_ratio(pair) * 0.8
 
     def set_freqai_targets(self, dataframe: DataFrame, metadata: dict, **kwargs):
         pair = str(metadata.get("pair"))
index df34fb3f4864b3777d1266c1dd1c9ae3369295e1..7dee6692dfb78594a94dc7f80f62b88358e87067 100644 (file)
@@ -417,24 +417,4 @@ def zigzag(
                 add_pivot(i, highs[i], TrendDirection.UP)
                 state = TrendDirection.UP
 
-    final_pos = len(df) - 1
-    last_pivot_val = pivots_values[-1]
-    if state == TrendDirection.UP:
-        if (
-            (last_pivot_val - lows[final_pos]) / last_pivot_val >= thresholds[final_pos]
-            and (final_pos - last_pivot_pos) >= depth
-            and is_fractal_low[final_pos]
-            and indices[final_pos] != pivots_indices[-1]
-        ):
-            add_pivot(final_pos, lows[final_pos], TrendDirection.DOWN)
-    elif state == TrendDirection.DOWN:
-        if (
-            (highs[final_pos] - last_pivot_val) / last_pivot_val
-            >= thresholds[final_pos]
-            and (final_pos - last_pivot_pos) >= depth
-            and is_fractal_high[final_pos]
-            and indices[final_pos] != pivots_indices[-1]
-        ):
-            add_pivot(final_pos, highs[final_pos], TrendDirection.UP)
-
     return pivots_indices, pivots_values, pivots_directions