add green_candle guard

This commit is contained in:
Janne Sinivirta 2017-11-11 09:35:04 +02:00
parent 274972f7af
commit 3db13fae13

View File

@ -38,6 +38,8 @@ def buy_strategy_generator(params):
conditions.append(dataframe['rsi'] < params['rsi']['value'])
if params['over_sar']['enabled']:
conditions.append(dataframe['close'] > dataframe['sar'])
if params['green_candle']['enabled']:
conditions.append(dataframe['close'] > dataframe['open'])
if params['uptrend_sma']['enabled']:
prevsma = dataframe['sma'].shift(1)
conditions.append(dataframe['sma'] > prevsma)
@ -115,6 +117,10 @@ def test_hyperopt(backtest_conf, backdata, mocker):
{'enabled': False},
{'enabled': True}
]),
'over_sar': hp.choice('green_candle', [
{'enabled': False},
{'enabled': True}
]),
'uptrend_sma': hp.choice('uptrend_sma', [
{'enabled': False},
{'enabled': True}