more parametrizing. adjust ranges for previous parameters

This commit is contained in:
Janne Sinivirta 2017-10-20 10:39:04 +03:00
parent ff100bdac4
commit bbb2c7cf62

View File

@ -82,7 +82,8 @@ def buy_strategy_generator(params):
print(params) print(params)
def populate_buy_trend(dataframe: DataFrame) -> DataFrame: def populate_buy_trend(dataframe: DataFrame) -> DataFrame:
conditions = [] conditions = []
conditions.append(dataframe['close'] < dataframe['sma']) if params['below_sma']['enabled']:
conditions.append(dataframe['close'] < dataframe['sma'])
conditions.append(dataframe['tema'] <= dataframe['blower']) conditions.append(dataframe['tema'] <= dataframe['blower'])
if params['mfi']['enabled']: if params['mfi']['enabled']:
conditions.append(dataframe['mfi'] < params['mfi']['value']) conditions.append(dataframe['mfi'] < params['mfi']['value'])
@ -108,15 +109,19 @@ def test_hyperopt(conf, pairs, mocker):
space = { space = {
'mfi': hp.choice('mfi', [ 'mfi': hp.choice('mfi', [
{'enabled': False}, {'enabled': False},
{'enabled': True, 'value': hp.uniform('mfi-value', 10, 50)} {'enabled': True, 'value': hp.uniform('mfi-value', 2, 40)}
]), ]),
'fastd': hp.choice('fastd', [ 'fastd': hp.choice('fastd', [
{'enabled': False}, {'enabled': False},
{'enabled': True, 'value': hp.uniform('fastd-value', 10, 50)} {'enabled': True, 'value': hp.uniform('fastd-value', 2, 40)}
]), ]),
'adx': hp.choice('adx', [ 'adx': hp.choice('adx', [
{'enabled': False}, {'enabled': False},
{'enabled': True, 'value': hp.uniform('adx-value', 10, 50)} {'enabled': True, 'value': hp.uniform('adx-value', 2, 40)}
]),
'below_sma': hp.choice('below_sma', [
{'enabled': False},
{'enabled': True}
]), ]),
} }