mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
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 talib.abstract as ta
|
||||
from pandas import DataFrame
|
||||
from qtpylib.indicators import awesome_oscillator, crossed_above
|
||||
|
||||
from freqtrade import exchange
|
||||
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['mfi'] = ta.MFI(dataframe)
|
||||
dataframe['cci'] = ta.CCI(dataframe)
|
||||
dataframe['ao'] = awesome_oscillator(dataframe)
|
||||
|
||||
return dataframe
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ from functools import reduce
|
|||
import pytest
|
||||
import arrow
|
||||
from pandas import DataFrame
|
||||
from qtpylib.indicators import crossed_above
|
||||
|
||||
from hyperopt import fmin, tpe, hp
|
||||
|
||||
|
@ -63,6 +64,7 @@ def buy_strategy_generator(params):
|
|||
triggers = {
|
||||
'lower_bb': dataframe['tema'] <= dataframe['blower'],
|
||||
'faststoch10': (dataframe['fastd'] >= 10) & (prev_fastd < 10),
|
||||
'ao_cross_zero': (crossed_above(dataframe['ao'], 0.0)),
|
||||
}
|
||||
conditions.append(triggers.get(params['trigger']['type']))
|
||||
|
||||
|
@ -124,7 +126,8 @@ def test_hyperopt(conf, pairs, mocker):
|
|||
]),
|
||||
'trigger': hp.choice('trigger', [
|
||||
{'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)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user