From 44b0bd83fc0ce2f97da3c24439fecf9e4bbff81a Mon Sep 17 00:00:00 2001 From: Kevin Johnson Date: Thu, 14 Apr 2022 12:07:14 -0700 Subject: [PATCH] ENH cg --- pandas_ta/momentum/cg.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas_ta/momentum/cg.py b/pandas_ta/momentum/cg.py index 175ac24..1379aa0 100644 --- a/pandas_ta/momentum/cg.py +++ b/pandas_ta/momentum/cg.py @@ -38,9 +38,9 @@ def cg( offset = v_offset(offset) # Calculate - coefficients = list(range(1, length + 1)) - numerator = -close.rolling(length).apply(weights(coefficients), raw=True) - cg = numerator / close.rolling(length).sum() + coefficients = range(1, length + 1) + numerator = close.rolling(length).apply(weights(coefficients), raw=True) + cg = -numerator / close.rolling(length).sum() # Offset if offset != 0: