]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
refactor(qav3): refine weighted_close() signature
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 21 Sep 2025 20:38:34 +0000 (22:38 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 21 Sep 2025 20:38:34 +0000 (22:38 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/strategies/QuickAdapterV3.py

index 6a0300278f667c0d4510443ece31d12c1417447e..6d326fb1ed3762a685221c8856db5685c1f347b5 100644 (file)
@@ -996,8 +996,10 @@ class QuickAdapterV3(IStrategy):
         return None
 
     @staticmethod
-    def weighted_close(series: Series) -> float:
-        return (series.get("high") + series.get("low") + 2 * series.get("close")) / 4.0
+    def weighted_close(series: Series, weight: float = 2.0) -> float:
+        return (
+            series.get("high") + series.get("low") + weight * series.get("close")
+        ) / (2.0 + weight)
 
     @staticmethod
     def _normalize_candle_idx(length: int, idx: int) -> int: