optimized strategy a bit

This commit is contained in:
Gert Wohlgemuth 2018-04-24 20:19:00 -07:00
parent 15ce56fff1
commit c83494cd9b

View File

@ -33,7 +33,7 @@ class Quickie(IStrategy):
stoploss = -0.3 stoploss = -0.3
# Optimal ticker interval for the strategy # Optimal ticker interval for the strategy
ticker_interval = 5 ticker_interval = 1
def populate_indicators(self, dataframe: DataFrame) -> DataFrame: def populate_indicators(self, dataframe: DataFrame) -> DataFrame:
macd = ta.MACD(dataframe) macd = ta.MACD(dataframe)
@ -44,8 +44,8 @@ class Quickie(IStrategy):
dataframe['cci'] = ta.CCI(dataframe) dataframe['cci'] = ta.CCI(dataframe)
dataframe['willr'] = ta.WILLR(dataframe) dataframe['willr'] = ta.WILLR(dataframe)
dataframe['smaSlow'] = ta.SMA(dataframe, timeperiod=7) dataframe['smaSlow'] = ta.EMA(dataframe, timeperiod=12)
dataframe['smaFast'] = ta.SMA(dataframe, timeperiod=13) dataframe['smaFast'] = ta.EMA(dataframe, timeperiod=26)
# required for graphing # required for graphing
bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=2) bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=2)
@ -69,13 +69,16 @@ class Quickie(IStrategy):
dataframe.loc[ dataframe.loc[
( (
# we want to buy oversold assets # we want to buy oversold assets
(dataframe['cci'] <= -50) # (dataframe['cci'] <= -50)
# some basic trend should have been established # some basic trend should have been established
& (dataframe['macd'] > dataframe['macdsignal']) # & (dataframe['macd'] > dataframe['macdsignal'])
# which starts inside the band # which starts inside the band
& (dataframe['open'] > dataframe['bb_lowerband']) # & (dataframe['open'] > dataframe['bb_lowerband'])
qtpylib.crossed_above(dataframe['smaFast'], dataframe['smaSlow'])
) )
, ,
'buy'] = 1 'buy'] = 1
@ -89,11 +92,8 @@ class Quickie(IStrategy):
:return: DataFrame with buy column :return: DataFrame with buy column
""" """
dataframe.loc[ dataframe.loc[
(dataframe['close'] >= dataframe['bb_upperband']) | qtpylib.crossed_above(dataframe['smaSlow'], dataframe['smaFast'])
(
(dataframe['macd'] < dataframe['macdsignal']) &
(dataframe['cci'] >= 100)
)
, ,
'sell'] = 1 'sell'] = 1
return dataframe return dataframe