diff --git a/freqtrade/vendor/qtpylib/indicators.py b/freqtrade/vendor/qtpylib/indicators.py index c4b955626..22fac4e2a 100644 --- a/freqtrade/vendor/qtpylib/indicators.py +++ b/freqtrade/vendor/qtpylib/indicators.py @@ -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") # ---------------------------------------------