drop zlma implementation

This commit is contained in:
gcarq 2018-06-13 16:20:13 +02:00
parent 6edb25f5c2
commit d684ff5715

View File

@ -261,6 +261,7 @@ def rolling_std(series, window=200, min_periods=None):
# --------------------------------------------- # ---------------------------------------------
def rolling_mean(series, window=200, min_periods=None): def rolling_mean(series, window=200, min_periods=None):
min_periods = window if min_periods is None else min_periods min_periods = window if min_periods is None else min_periods
if min_periods == window and len(series) > window: if min_periods == window and len(series) > window:
@ -273,6 +274,7 @@ def rolling_mean(series, window=200, min_periods=None):
# --------------------------------------------- # ---------------------------------------------
def rolling_min(series, window=14, min_periods=None): def rolling_min(series, window=14, min_periods=None):
min_periods = window if min_periods is None else min_periods min_periods = window if min_periods is None else min_periods
try: try:
@ -556,27 +558,7 @@ def stoch(df, window=14, d=3, k=3, fast=False):
return pd.DataFrame(index=df.index, data=data) return pd.DataFrame(index=df.index, data=data)
# --------------------------------------------- # ---------------------------------------------
def zlma(series, window=20, kind="ema"):
"""
John Ehlers' Zero lag (exponential) moving average
https://en.wikipedia.org/wiki/Zero_lag_exponential_moving_average
"""
lag = (window - 1) // 2
series = 2 * series - series.shift(lag)
if kind in ['ewm', 'ema']:
return ema(series, lag)
elif kind == "hma":
return hma(series, lag)
return sma(series, lag)
def zlema(series, window):
return zlma(series, window, kind="ema")
def zlsma(series, window):
return zlma(series, window, kind="sma")
def zlhma(series, window):
return zlma(series, window, kind="hma")
# ---------------------------------------------
def zscore(bars, window=20, stds=1, col='close'): def zscore(bars, window=20, stds=1, col='close'):
""" get zscore of price """ """ get zscore of price """