add uptrend_sma to hyperopt

This commit is contained in:
Janne Sinivirta 2017-10-20 18:29:38 +03:00
parent 0fbca8b8ef
commit ce2966dd7f
1 changed files with 7 additions and 0 deletions

View File

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