Merge branch 'pr/511' into development

This commit is contained in:
Kevin Johnson
2022-04-14 12:07:28 -07:00
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -38,9 +38,9 @@ def cg(
offset = v_offset(offset)
# Calculate
coefficients = [length - i for i in range(0, length)]
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:
+1 -1
View File
@@ -65,7 +65,7 @@ def linreg(
# Calculate
np_close = close.values
if Imports["talib"] and mode_tal:
if Imports["talib"] and mode_tal and not r:
from talib import LINEARREG, LINEARREG_ANGLE, LINEARREG_INTERCEPT, LINEARREG_SLOPE, TSF
if tsf:
linreg = TSF(close, timeperiod=length)