# Source: generated via dynamic_strategy_generator from freqtrade.strategy import IStrategy from pandas import DataFrame import talib.abstract as ta import freqtrade.vendor.qtpylib.indicators as qtpylib class ACO_24_19(IStrategy): timeframe = '1h' # Standard ROI and Stoploss minimal_roi = {"0": 0.1, "60": 0.05, "120": 0.0} stoploss = -0.05 def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: macd = ta.MACD(dataframe, fastperiod=12, slowperiod=26, signalperiod=9) dataframe['macd'] = macd['macd'] dataframe['macdsignal'] = macd['macdsignal'] dataframe['macdhist'] = macd['macdhist'] stoch = ta.STOCH(dataframe, fastk_period=21, slowk_period=5, slowd_period=5) dataframe['slowk'] = stoch['slowk'] dataframe['slowd'] = stoch['slowd'] dataframe['kama'] = ta.KAMA(dataframe, timeperiod=30) dataframe['t3'] = ta.T3(dataframe, timeperiod=5, vfactor=0.7) dataframe['sar'] = ta.SAR(dataframe, acceleration=0.01, maximum=0.1) bbands = ta.BBANDS(dataframe, timeperiod=20, nbdevup=1.5, nbdevdn=1.5) dataframe['upperband'] = bbands['upperband'] dataframe['middleband'] = bbands['middleband'] dataframe['lowerband'] = bbands['lowerband'] dataframe['adosc'] = ta.ADOSC(dataframe, fastperiod=2, slowperiod=5) return dataframe def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe.loc[ ( qtpylib.crossed_above(dataframe['macd'], dataframe['macdsignal']) ) & ( (dataframe['slowk'] < 25) ) & ( qtpylib.crossed_above(dataframe['close'], dataframe['kama']) ), 'enter_long'] = 1 return dataframe def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe.loc[ ( qtpylib.crossed_below(dataframe['close'], dataframe['t3']) ) & ( qtpylib.crossed_below(dataframe['close'], dataframe['sar']) ) & ( (dataframe['close'] > dataframe['upperband'] * 1.0) ) & ( qtpylib.crossed_below(dataframe['adosc'], 0) ), 'exit_long'] = 1 return dataframe