mirror of
https://github.com/wassname/pandas-ta.git
synced 2026-08-18 12:20:24 +08:00
Merge branch 'pr/511' into development
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user