added zlma
This commit is contained in:
parent
61f92b7460
commit
e6e5c5daf0
20
freqtrade/vendor/qtpylib/indicators.py
vendored
20
freqtrade/vendor/qtpylib/indicators.py
vendored
@ -552,6 +552,26 @@ def stoch(df, window=14, d=3, k=3, fast=False):
|
||||
|
||||
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")
|
||||
|
||||
# ---------------------------------------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user