From 1d5c3f34ae357badcfdf196ad7571ac4a2835d1d Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 26 Jun 2019 19:59:57 +0200 Subject: [PATCH] Update qtpylib from source --- freqtrade/vendor/qtpylib/indicators.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/freqtrade/vendor/qtpylib/indicators.py b/freqtrade/vendor/qtpylib/indicators.py index 6edf626f0..b3b2ac533 100644 --- a/freqtrade/vendor/qtpylib/indicators.py +++ b/freqtrade/vendor/qtpylib/indicators.py @@ -213,8 +213,7 @@ def atr(bars, window=14, exp=False): else: res = rolling_mean(tr, window) - res = pd.Series(res) - return (res.shift(1) * (window - 1) + res) / window + return pd.Series(res) # --------------------------------------------- @@ -602,6 +601,14 @@ def pvt(bars): bars['close'].shift(1)) * bars['volume'] return trend.cumsum() + +def chopiness(bars, window=14): + atrsum = true_range(bars).rolling(window).sum() + highs = bars['high'].rolling(window).max() + lows = bars['low'].rolling(window).min() + return 100 * np.log10(atrsum / (highs - lows)) / np.log10(window) + + # ============================================= @@ -629,6 +636,7 @@ PandasObject.rsi = rsi PandasObject.stoch = stoch PandasObject.zscore = zscore PandasObject.pvt = pvt +PandasObject.chopiness = chopiness PandasObject.tdi = tdi PandasObject.true_range = true_range PandasObject.mid_price = mid_price