]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
refactor(qav3): zigzag() trivial code cleanup
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 5 May 2025 19:09:27 +0000 (21:09 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 5 May 2025 19:09:27 +0000 (21:09 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/Utils.py

index e2546bb04744d5de7886c0e106fc0905d60ffa49..9291f69eec9ca22e5c78a77e1138d367f40f6560 100644 (file)
@@ -961,7 +961,7 @@ def zigzag(
     else:
         return [], [], []
 
-    if last_pivot_pos + depth >= n:
+    if n - last_pivot_pos - 1 < depth:
         return pivots_indices, pivots_values, pivots_directions
 
     for i in range(last_pivot_pos + 1, n):
index 8cb61049425c2004d20a0db8a5940a99dbd89dd9..0634c6266285c888be17c53d32feb769db9c74ea 100644 (file)
@@ -451,7 +451,7 @@ def zigzag(
     else:
         return [], [], []
 
-    if last_pivot_pos + depth >= n:
+    if n - last_pivot_pos - 1 < depth:
         return pivots_indices, pivots_values, pivots_directions
 
     for i in range(last_pivot_pos + 1, n):