]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
fix(quickadapter): correct volume rate span
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 30 Jul 2026 19:41:47 +0000 (21:41 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 30 Jul 2026 19:54:16 +0000 (21:54 +0200)
quickadapter/user_data/strategies/Utils.py

index fcd141afe7e7a9277840af772739ca75e38444a5..a306d18e496c65b70525c3ca1d396ad58ad2c03c 100644 (file)
@@ -4317,7 +4317,9 @@ def _zigzag(
 
         start_pos = min(previous_pos, current_pos)
         end_pos = max(previous_pos, current_pos) + 1
-        avg_volume_per_candle = np.nansum(volumes[start_pos:end_pos]) / duration
+        avg_volume_per_candle = np.nansum(volumes[start_pos:end_pos]) / (
+            end_pos - start_pos
+        )
         median_volume = np.nanmedian(volumes[start_pos:end_pos])
         if (
             np.isfinite(avg_volume_per_candle)