From: Jérôme Benoit Date: Mon, 28 Apr 2025 20:51:50 +0000 (+0200) Subject: refactor(qav3): more cleanup to zigzag() X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=adfb99ee0c898bf9ecf0f2432f3693decbc976cf;p=freqai-strategies.git refactor(qav3): more cleanup to zigzag() Signed-off-by: Jérôme Benoit --- 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