add uptrend_sma to hyperopt

This commit is contained in:
Janne Sinivirta 2017-10-20 18:29:38 +03:00
parent 0fbca8b8ef
commit ce2966dd7f

View File

@ -97,6 +97,9 @@ def buy_strategy_generator(params):
conditions.append(dataframe['cci'] < params['cci']['value']) conditions.append(dataframe['cci'] < params['cci']['value'])
if params['over_sar']['enabled']: if params['over_sar']['enabled']:
conditions.append(dataframe['close'] > dataframe['sar']) conditions.append(dataframe['close'] > dataframe['sar'])
if params['uptrend_sma']['enabled']:
prevsma = dataframe['sma'].shift(1)
conditions.append(dataframe['sma'] > prevsma)
dataframe.loc[ dataframe.loc[
reduce(lambda x, y: x & y, conditions), reduce(lambda x, y: x & y, conditions),
'buy'] = 1 'buy'] = 1
@ -140,6 +143,10 @@ def test_hyperopt(conf, pairs, mocker):
{'enabled': False}, {'enabled': False},
{'enabled': True} {'enabled': True}
]), ]),
'uptrend_sma': hp.choice('uptrend_sma', [
{'enabled': False},
{'enabled': True}
]),
} }
# print(hyperopt.pyll.stochastic.sample(space)) # print(hyperopt.pyll.stochastic.sample(space))