From b268720917d582ef47e31de8c91c8906d71150f9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 2 May 2025 23:00:10 +0200 Subject: [PATCH] refactor(qav3): cleanup zigzag() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../freqaimodels/QuickAdapterRegressorV3.py | 20 ------------------- .../user_data/strategies/QuickAdapterV3.py | 4 ++-- quickadapter/user_data/strategies/Utils.py | 20 ------------------- 3 files changed, 2 insertions(+), 42 deletions(-) diff --git a/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py b/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py index e5c5f37..5d7bab1 100644 --- a/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py +++ b/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py @@ -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 diff --git a/quickadapter/user_data/strategies/QuickAdapterV3.py b/quickadapter/user_data/strategies/QuickAdapterV3.py index 43aef1f..fb3140b 100644 --- a/quickadapter/user_data/strategies/QuickAdapterV3.py +++ b/quickadapter/user_data/strategies/QuickAdapterV3.py @@ -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")) diff --git a/quickadapter/user_data/strategies/Utils.py b/quickadapter/user_data/strategies/Utils.py index df34fb3..7dee669 100644 --- a/quickadapter/user_data/strategies/Utils.py +++ b/quickadapter/user_data/strategies/Utils.py @@ -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 -- 2.43.0