# 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_4_5(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: dataframe['tema'] = ta.TEMA(dataframe, timeperiod=10) bbands = ta.BBANDS(dataframe, timeperiod=20, nbdevup=2.5, nbdevdn=2.5) dataframe['upperband'] = bbands['upperband'] dataframe['middleband'] = bbands['middleband'] dataframe['lowerband'] = bbands['lowerband'] dataframe['cmo'] = ta.CMO(dataframe, timeperiod=14) dataframe['mom'] = ta.MOM(dataframe, timeperiod=5) dataframe['roc'] = ta.ROC(dataframe, timeperiod=10) dataframe['wma'] = ta.WMA(dataframe, timeperiod=20) dataframe['ad'] = ta.AD(dataframe) dataframe['ad_sma'] = ta.SMA(dataframe, timeperiod=20, price='ad') return dataframe def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe.loc[ ( qtpylib.crossed_above(dataframe['close'], dataframe['tema']) ) & ( (dataframe['close'] < dataframe['lowerband'] * 1.0) ), 'enter_long'] = 1 return dataframe def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe.loc[ ( (dataframe['cmo'] > 50) ) & ( qtpylib.crossed_below(dataframe['mom'], 0) ) & ( qtpylib.crossed_below(dataframe['roc'], 0) ) & ( qtpylib.crossed_below(dataframe['close'], dataframe['wma']) ) & ( qtpylib.crossed_below(dataframe['ad'], dataframe['ad_sma']) ), 'exit_long'] = 1 return dataframe