add Awesome Oscillator and try it in hyperopt
This commit is contained in:
parent
d5d798f6fa
commit
6ba2492360
@ -5,6 +5,7 @@ from datetime import timedelta
|
|||||||
import arrow
|
import arrow
|
||||||
import talib.abstract as ta
|
import talib.abstract as ta
|
||||||
from pandas import DataFrame
|
from pandas import DataFrame
|
||||||
|
from qtpylib.indicators import awesome_oscillator, crossed_above
|
||||||
|
|
||||||
from freqtrade import exchange
|
from freqtrade import exchange
|
||||||
from freqtrade.exchange import Bittrex, get_ticker_history
|
from freqtrade.exchange import Bittrex, get_ticker_history
|
||||||
@ -41,6 +42,8 @@ def populate_indicators(dataframe: DataFrame) -> DataFrame:
|
|||||||
dataframe['tema'] = ta.TEMA(dataframe, timeperiod=9)
|
dataframe['tema'] = ta.TEMA(dataframe, timeperiod=9)
|
||||||
dataframe['mfi'] = ta.MFI(dataframe)
|
dataframe['mfi'] = ta.MFI(dataframe)
|
||||||
dataframe['cci'] = ta.CCI(dataframe)
|
dataframe['cci'] = ta.CCI(dataframe)
|
||||||
|
dataframe['ao'] = awesome_oscillator(dataframe)
|
||||||
|
|
||||||
return dataframe
|
return dataframe
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ from functools import reduce
|
|||||||
import pytest
|
import pytest
|
||||||
import arrow
|
import arrow
|
||||||
from pandas import DataFrame
|
from pandas import DataFrame
|
||||||
|
from qtpylib.indicators import crossed_above
|
||||||
|
|
||||||
from hyperopt import fmin, tpe, hp
|
from hyperopt import fmin, tpe, hp
|
||||||
|
|
||||||
@ -63,6 +64,7 @@ def buy_strategy_generator(params):
|
|||||||
triggers = {
|
triggers = {
|
||||||
'lower_bb': dataframe['tema'] <= dataframe['blower'],
|
'lower_bb': dataframe['tema'] <= dataframe['blower'],
|
||||||
'faststoch10': (dataframe['fastd'] >= 10) & (prev_fastd < 10),
|
'faststoch10': (dataframe['fastd'] >= 10) & (prev_fastd < 10),
|
||||||
|
'ao_cross_zero': (crossed_above(dataframe['ao'], 0.0)),
|
||||||
}
|
}
|
||||||
conditions.append(triggers.get(params['trigger']['type']))
|
conditions.append(triggers.get(params['trigger']['type']))
|
||||||
|
|
||||||
@ -124,7 +126,8 @@ def test_hyperopt(conf, pairs, mocker):
|
|||||||
]),
|
]),
|
||||||
'trigger': hp.choice('trigger', [
|
'trigger': hp.choice('trigger', [
|
||||||
{'type': 'lower_bb'},
|
{'type': 'lower_bb'},
|
||||||
{'type': 'faststoch10'}
|
{'type': 'faststoch10'},
|
||||||
|
{'type': 'ao_cross_zero'}
|
||||||
]),
|
]),
|
||||||
}
|
}
|
||||||
print('Best parameters {}'.format(fmin(fn=optimizer, space=space, algo=tpe.suggest, max_evals=40)))
|
print('Best parameters {}'.format(fmin(fn=optimizer, space=space, algo=tpe.suggest, max_evals=40)))
|
||||||
|
Loading…
Reference in New Issue
Block a user