From ba476c201de2665a3ff7c751e186332b055220e1 Mon Sep 17 00:00:00 2001 From: Gert Wohlgemuth Date: Mon, 30 Apr 2018 14:25:44 -0700 Subject: [PATCH] added insurance policy to not buy in massivley falling market --- user_data/strategies/Quickie.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/user_data/strategies/Quickie.py b/user_data/strategies/Quickie.py index a135b932a..f6ce17359 100644 --- a/user_data/strategies/Quickie.py +++ b/user_data/strategies/Quickie.py @@ -41,10 +41,11 @@ class Quickie(IStrategy): dataframe['macdhist'] = macd['macdhist'] dataframe['tema'] = ta.TEMA(dataframe, timeperiod=9) + dataframe['sma_200'] = ta.SMA(dataframe,timeperiod=200) dataframe['adx'] = ta.ADX(dataframe) # required for graphing - bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=2) + bollinger = qtpylib.bollinger_bands(dataframe['close'], window=20, stds=2) dataframe['bb_lowerband'] = bollinger['lower'] dataframe['bb_middleband'] = bollinger['mid'] dataframe['bb_upperband'] = bollinger['upper'] @@ -56,7 +57,8 @@ class Quickie(IStrategy): ( (dataframe['adx'] > 30) & (dataframe['tema'] < dataframe['bb_middleband']) & - (dataframe['tema'] > dataframe['tema'].shift(1)) + (dataframe['tema'] > dataframe['tema'].shift(1)) & + (dataframe['sma_200'] > dataframe['close']) ), 'buy'] = 1 return dataframe