Merge pull request #1972 from freqtrade/update_qtpylib

Update qtpylib from source
This commit is contained in:
Matthias 2019-06-26 20:34:28 +02:00 committed by GitHub
commit 596cee2dc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,8 +213,7 @@ def atr(bars, window=14, exp=False):
else: else:
res = rolling_mean(tr, window) res = rolling_mean(tr, window)
res = pd.Series(res) return pd.Series(res)
return (res.shift(1) * (window - 1) + res) / window
# --------------------------------------------- # ---------------------------------------------
@ -602,6 +601,14 @@ def pvt(bars):
bars['close'].shift(1)) * bars['volume'] bars['close'].shift(1)) * bars['volume']
return trend.cumsum() 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.stoch = stoch
PandasObject.zscore = zscore PandasObject.zscore = zscore
PandasObject.pvt = pvt PandasObject.pvt = pvt
PandasObject.chopiness = chopiness
PandasObject.tdi = tdi PandasObject.tdi = tdi
PandasObject.true_range = true_range PandasObject.true_range = true_range
PandasObject.mid_price = mid_price PandasObject.mid_price = mid_price