add CCI to hyperopt

This commit is contained in:
Janne Sinivirta 2017-10-20 13:14:28 +03:00
parent 3f7a583de6
commit 0fbca8b8ef
2 changed files with 7 additions and 0 deletions

View File

@ -40,6 +40,7 @@ def populate_indicators(dataframe: DataFrame) -> DataFrame:
dataframe['sma'] = ta.SMA(dataframe, timeperiod=40)
dataframe['tema'] = ta.TEMA(dataframe, timeperiod=9)
dataframe['mfi'] = ta.MFI(dataframe)
dataframe['cci'] = ta.CCI(dataframe)
return dataframe

View File

@ -93,6 +93,8 @@ def buy_strategy_generator(params):
conditions.append(dataframe['fastd'] < params['fastd']['value'])
if params['adx']['enabled']:
conditions.append(dataframe['adx'] > params['adx']['value'])
if params['cci']['enabled']:
conditions.append(dataframe['cci'] < params['cci']['value'])
if params['over_sar']['enabled']:
conditions.append(dataframe['close'] > dataframe['sar'])
dataframe.loc[
@ -122,6 +124,10 @@ def test_hyperopt(conf, pairs, mocker):
{'enabled': False},
{'enabled': True, 'value': hp.uniform('adx-value', 2, 40)}
]),
'cci': hp.choice('cci', [
{'enabled': False},
{'enabled': True, 'value': hp.uniform('cci-value', -200, -100)}
]),
'below_sma': hp.choice('below_sma', [
{'enabled': False},
{'enabled': True}