mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-14 04:03:55 +00:00
Change Bollinger bands for qtpylib.bollinger_bands
This commit is contained in:
parent
297166fcb9
commit
83a999d16e
|
@ -107,21 +107,25 @@ def populate_indicators(dataframe: DataFrame) -> DataFrame:
|
||||||
# Overlap Studies
|
# Overlap Studies
|
||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
|
|
||||||
|
# Previous Bollinger bands
|
||||||
|
# Because ta.BBANDS implementation is broken with small numbers, it actually
|
||||||
|
# returns middle band for all the three bands. Switch to qtpylib.bollinger_bands
|
||||||
|
# and use middle band instead.
|
||||||
|
dataframe['blower'] = ta.BBANDS(dataframe, nbdevup=2, nbdevdn=2)['lowerband']
|
||||||
|
"""
|
||||||
# Bollinger bands
|
# Bollinger bands
|
||||||
bollinger = ta.BBANDS(dataframe, nbdevup=2, nbdevdn=2)
|
bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=2)
|
||||||
dataframe['bb_lowerband'] = bollinger['lowerband']
|
dataframe['bb_lowerband'] = bollinger['lower']
|
||||||
"""
|
dataframe['bb_middleband'] = bollinger['mid']
|
||||||
dataframe['bb_middleband'] = bollinger['middleband']
|
dataframe['bb_upperband'] = bollinger['upper']
|
||||||
dataframe['bb_upperband'] = bollinger['upperband']
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# EMA - Exponential Moving Average
|
# EMA - Exponential Moving Average
|
||||||
dataframe['ema5'] = ta.EMA(dataframe, timeperiod=5)
|
dataframe['ema5'] = ta.EMA(dataframe, timeperiod=5)
|
||||||
dataframe['ema10'] = ta.EMA(dataframe, timeperiod=10)
|
dataframe['ema10'] = ta.EMA(dataframe, timeperiod=10)
|
||||||
dataframe['ema50'] = ta.EMA(dataframe, timeperiod=50)
|
dataframe['ema50'] = ta.EMA(dataframe, timeperiod=50)
|
||||||
dataframe['ema100'] = ta.EMA(dataframe, timeperiod=100)
|
dataframe['ema100'] = ta.EMA(dataframe, timeperiod=100)
|
||||||
"""
|
|
||||||
dataframe['ema200'] = ta.EMA(dataframe, timeperiod=200)
|
|
||||||
"""
|
|
||||||
# SAR Parabol
|
# SAR Parabol
|
||||||
dataframe['sar'] = ta.SAR(dataframe)
|
dataframe['sar'] = ta.SAR(dataframe)
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ def buy_strategy_generator(params):
|
||||||
|
|
||||||
# TRIGGERS
|
# TRIGGERS
|
||||||
triggers = {
|
triggers = {
|
||||||
'lower_bb': dataframe['tema'] <= dataframe['bb_lowerband'],
|
'lower_bb': dataframe['tema'] <= dataframe['blower'],
|
||||||
'faststoch10': (crossed_above(dataframe['fastd'], 10.0)),
|
'faststoch10': (crossed_above(dataframe['fastd'], 10.0)),
|
||||||
'ao_cross_zero': (crossed_above(dataframe['ao'], 0.0)),
|
'ao_cross_zero': (crossed_above(dataframe['ao'], 0.0)),
|
||||||
'ema5_cross_ema10': (crossed_above(dataframe['ema5'], dataframe['ema10'])),
|
'ema5_cross_ema10': (crossed_above(dataframe['ema5'], dataframe['ema10'])),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user