From adfb99ee0c898bf9ecf0f2432f3693decbc976cf Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 28 Apr 2025 22:51:50 +0200 Subject: [PATCH] refactor(qav3): more cleanup to zigzag() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../user_data/freqaimodels/QuickAdapterRegressorV3.py | 4 ++-- quickadapter/user_data/strategies/Utils.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py b/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py index 47e9856..5d0a570 100644 --- a/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py +++ b/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py @@ -923,8 +923,8 @@ def zigzag( add_pivot(i, highs[i], TrendDirection.UP) state = TrendDirection.UP - if state != TrendDirection.NEUTRAL and (len(df) - 1 - last_pivot_pos) >= depth: - final_pos = len(df) - 1 + final_pos = len(df) - 1 + if state != TrendDirection.NEUTRAL and (final_pos - last_pivot_pos) >= depth: last_pivot_val = pivots_values[-1] price_move = ( (highs[final_pos] - last_pivot_val) / last_pivot_val diff --git a/quickadapter/user_data/strategies/Utils.py b/quickadapter/user_data/strategies/Utils.py index ddbd6e8..2e56ccc 100644 --- a/quickadapter/user_data/strategies/Utils.py +++ b/quickadapter/user_data/strategies/Utils.py @@ -378,8 +378,8 @@ def zigzag( add_pivot(i, highs[i], TrendDirection.UP) state = TrendDirection.UP - if state != TrendDirection.NEUTRAL and (len(df) - 1 - last_pivot_pos) >= depth: - final_pos = len(df) - 1 + final_pos = len(df) - 1 + if state != TrendDirection.NEUTRAL and (final_pos - last_pivot_pos) >= depth: last_pivot_val = pivots_values[-1] price_move = ( (highs[final_pos] - last_pivot_val) / last_pivot_val -- 2.43.0