mirror of
https://github.com/wassname/pandas-ta.git
synced 2026-07-17 11:31:03 +08:00
ENH cg
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user