├── Ichimoku_v1.py ├── Ichimoku_v10.py ├── Ichimoku_v11.py ├── Ichimoku_v12.py ├── Ichimoku_v13.py ├── Ichimoku_v14.py ├── Ichimoku_v15_1d.py ├── Ichimoku_v16_1d.py ├── Ichimoku_v17.py ├── Ichimoku_v18.py ├── Ichimoku_v19.py ├── Ichimoku_v2.py ├── Ichimoku_v20.py ├── Ichimoku_v21.py ├── Ichimoku_v22.py ├── Ichimoku_v23.py ├── Ichimoku_v24.png ├── Ichimoku_v24.py ├── Ichimoku_v25.png ├── Ichimoku_v25.py ├── Ichimoku_v26_1d.py ├── Ichimoku_v27_1d.py ├── Ichimoku_v28_1d.py ├── Ichimoku_v29_1d.py ├── Ichimoku_v3.py ├── Ichimoku_v30_DojiStar.py ├── Ichimoku_v31_Heikin.py ├── Ichimoku_v32_HeikinAshi.py ├── Ichimoku_v33_SAR.py ├── Ichimoku_v34.py ├── Ichimoku_v35_SAR_1d.py ├── Ichimoku_v36_SAR_1s.py ├── Ichimoku_v37_HeikinAshi.py ├── Ichimoku_v38_HeikinAshi.py ├── Ichimoku_v4.py ├── Ichimoku_v5.py ├── Ichimoku_v6.py ├── Ichimoku_v7.py ├── Ichimoku_v8.py ├── Ichimoku_v9.py ├── README.md ├── backtesting.png ├── backtesting_2.png ├── backtesting_3.png └── config_usdt.json /Ichimoku_v1.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | # from freqtrade.vendor.qtpylib.indicators import stoch 10 | 11 | class Ichimoku_v1(IStrategy): 12 | 13 | minimal_roi = { 14 | "0": 10, 15 | "43200": 7.5 16 | } 17 | 18 | ticker_interval = '4h' #3m 19 | 20 | # startup_candle_count: int = 2 21 | 22 | # trailing stoploss 23 | stoploss = -1 24 | trailing_stop = True 25 | trailing_stop_positive = 0.35 26 | trailing_stop_positive_offset = 0.50 27 | trailing_only_offset_is_reached = True 28 | 29 | def informative_pairs(self): 30 | return [ 31 | ] 32 | 33 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 34 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 35 | # dataframe['chikou_span'] = ichi['chikou_span'] 36 | dataframe['tenkan'] = ichi['tenkan_sen'] 37 | dataframe['kijun'] = ichi['kijun_sen'] 38 | dataframe['senkou_a'] = ichi['senkou_span_a'] 39 | dataframe['senkou_b'] = ichi['senkou_span_b'] 40 | dataframe['cloud_green'] = ichi['cloud_green'] 41 | dataframe['cloud_red'] = ichi['cloud_red'] 42 | 43 | # dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) 44 | 45 | return dataframe 46 | 47 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 48 | dataframe.loc[ 49 | ( 50 | (qtpylib.crossed_above(dataframe['senkou_a'], dataframe['senkou_b'])) & 51 | (dataframe['close'] > dataframe['senkou_a']) & 52 | (dataframe['close'] > dataframe['senkou_b']) & 53 | (dataframe['cloud_green'] == True) 54 | ), 55 | 'buy'] = 1 56 | 57 | dataframe.loc[ 58 | ( 59 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_a'])) & 60 | (dataframe['tenkan'] > dataframe['kijun']) & 61 | (dataframe['close'] > dataframe['tenkan']) & 62 | (dataframe['cloud_green'] == True) 63 | 64 | ), 65 | 'buy'] = 1 66 | 67 | return dataframe 68 | 69 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 70 | dataframe.loc[ 71 | ( 72 | (qtpylib.crossed_above(dataframe['senkou_b'], dataframe['senkou_a'])) & 73 | (dataframe['close'] < dataframe['senkou_a']) & 74 | (dataframe['close'] < dataframe['senkou_b']) & 75 | (dataframe['cloud_red'] == True) 76 | ), 77 | 'sell'] = 1 78 | 79 | return dataframe 80 | -------------------------------------------------------------------------------- /Ichimoku_v10.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v10(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 100 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [] 33 | 34 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 35 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 36 | # dataframe['chikou_span'] = ichi['chikou_span'] 37 | dataframe['tenkan'] = ichi['tenkan_sen'] 38 | dataframe['kijun'] = ichi['kijun_sen'] 39 | dataframe['senkou_a'] = ichi['senkou_span_a'] 40 | dataframe['senkou_b'] = ichi['senkou_span_b'] 41 | dataframe['cloud_green'] = ichi['cloud_green'] 42 | dataframe['cloud_red'] = ichi['cloud_red'] 43 | 44 | return dataframe 45 | 46 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 47 | dataframe.loc[ 48 | ( 49 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_a'])) & 50 | (dataframe['close'] > dataframe['senkou_a']) & 51 | (dataframe['close'] > dataframe['senkou_b']) 52 | ), 53 | 'buy'] = 1 54 | 55 | dataframe.loc[ 56 | ( 57 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_b'])) & 58 | (dataframe['close'] > dataframe['senkou_a']) & 59 | (dataframe['close'] > dataframe['senkou_b']) 60 | ), 61 | 'buy'] = 1 62 | 63 | return dataframe 64 | 65 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 66 | dataframe.loc[ 67 | ( 68 | (qtpylib.crossed_below(dataframe['close'], dataframe['senkou_b'])) & 69 | (dataframe['close'] < dataframe['senkou_a']) & 70 | (dataframe['close'] < dataframe['senkou_b']) 71 | ), 72 | 'sell'] = 1 73 | 74 | dataframe.loc[ 75 | ( 76 | (qtpylib.crossed_below(dataframe['close'], dataframe['senkou_a'])) & 77 | (dataframe['close'] < dataframe['senkou_a']) & 78 | (dataframe['close'] < dataframe['senkou_b']) 79 | ), 80 | 'sell'] = 1 81 | 82 | return dataframe 83 | -------------------------------------------------------------------------------- /Ichimoku_v11.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v11(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 100 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [] 33 | 34 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 35 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 36 | # dataframe['chikou_span'] = ichi['chikou_span'] 37 | dataframe['tenkan'] = ichi['tenkan_sen'] 38 | dataframe['kijun'] = ichi['kijun_sen'] 39 | dataframe['senkou_a'] = ichi['senkou_span_a'] 40 | dataframe['senkou_b'] = ichi['senkou_span_b'] 41 | dataframe['cloud_green'] = ichi['cloud_green'] 42 | dataframe['cloud_red'] = ichi['cloud_red'] 43 | 44 | return dataframe 45 | 46 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 47 | dataframe.loc[ 48 | ( 49 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_a'])) & 50 | (dataframe['close'] > dataframe['senkou_a']) & 51 | (dataframe['close'] > dataframe['senkou_b']) 52 | ), 53 | 'buy'] = 1 54 | 55 | dataframe.loc[ 56 | ( 57 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_b'])) & 58 | (dataframe['close'] > dataframe['senkou_a']) & 59 | (dataframe['close'] > dataframe['senkou_b']) 60 | ), 61 | 'buy'] = 1 62 | 63 | return dataframe 64 | 65 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 66 | # dataframe.loc[ 67 | # ( 68 | # (qtpylib.crossed_below(dataframe['close'], dataframe['senkou_b'])) & 69 | # (dataframe['close'] < dataframe['senkou_a']) & 70 | # (dataframe['close'] < dataframe['senkou_b']) 71 | # ), 72 | # 'sell'] = 1 73 | # 74 | # dataframe.loc[ 75 | # ( 76 | # (qtpylib.crossed_below(dataframe['close'], dataframe['senkou_a'])) & 77 | # (dataframe['close'] < dataframe['senkou_a']) & 78 | # (dataframe['close'] < dataframe['senkou_b']) 79 | # ), 80 | # 'sell'] = 1 81 | 82 | return dataframe 83 | -------------------------------------------------------------------------------- /Ichimoku_v12.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v12(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 0.05 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [] 33 | 34 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 35 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 36 | # dataframe['chikou_span'] = ichi['chikou_span'] 37 | dataframe['tenkan'] = ichi['tenkan_sen'] 38 | dataframe['kijun'] = ichi['kijun_sen'] 39 | dataframe['senkou_a'] = ichi['senkou_span_a'] 40 | dataframe['senkou_b'] = ichi['senkou_span_b'] 41 | dataframe['cloud_green'] = ichi['cloud_green'] 42 | dataframe['cloud_red'] = ichi['cloud_red'] 43 | 44 | return dataframe 45 | 46 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 47 | dataframe.loc[ 48 | ( 49 | (dataframe['close'] > dataframe['senkou_a']) & 50 | (dataframe['close'] > dataframe['senkou_b']) 51 | ), 52 | 'buy'] = 1 53 | 54 | dataframe.loc[ 55 | ( 56 | (dataframe['close'] > dataframe['senkou_a']) & 57 | (dataframe['close'] > dataframe['senkou_b']) 58 | ), 59 | 'buy'] = 1 60 | 61 | return dataframe 62 | 63 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 64 | # dataframe.loc[ 65 | # ( 66 | # (qtpylib.crossed_below(dataframe['close'], dataframe['senkou_b'])) & 67 | # (dataframe['close'] < dataframe['senkou_a']) & 68 | # (dataframe['close'] < dataframe['senkou_b']) 69 | # ), 70 | # 'sell'] = 1 71 | # 72 | # dataframe.loc[ 73 | # ( 74 | # (qtpylib.crossed_below(dataframe['close'], dataframe['senkou_a'])) & 75 | # (dataframe['close'] < dataframe['senkou_a']) & 76 | # (dataframe['close'] < dataframe['senkou_b']) 77 | # ), 78 | # 'sell'] = 1 79 | 80 | return dataframe 81 | -------------------------------------------------------------------------------- /Ichimoku_v13.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from freqtrade.strategy import IStrategy, merge_informative_pair 3 | from pandas import DataFrame 4 | #from technical.indicators import accumulation_distribution 5 | from technical.util import resample_to_interval, resampled_merge 6 | import talib.abstract as ta 7 | import freqtrade.vendor.qtpylib.indicators as qtpylib 8 | import numpy 9 | from technical.indicators import ichimoku 10 | 11 | class Ichimoku_v13(IStrategy): 12 | """ 13 | 14 | """ 15 | 16 | minimal_roi = { 17 | "0": 10 18 | } 19 | 20 | stoploss = -1 #-0.35 21 | 22 | ticker_interval = '4h' #3m 23 | 24 | # startup_candle_count: int = 2 25 | 26 | # trailing stoploss 27 | #trailing_stop = True 28 | #trailing_stop_positive = 0.40 #0.35 29 | #trailing_stop_positive_offset = 0.50 30 | #trailing_only_offset_is_reached = False 31 | 32 | def informative_pairs(self): 33 | # Optionally Add additional "static" pairs 34 | informative_pairs += [("BTC/USDT", "1d")] 35 | 36 | return informative_pairs 37 | 38 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 39 | if not self.dp: 40 | # Don't do anything if DataProvider is not available. 41 | return dataframe 42 | 43 | inf_tf = '1d' 44 | # Get the informative pair 45 | informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=inf_tf) 46 | # Get the 14 day rsi 47 | # informative['rsi'] = ta.RSI(informative, timeperiod=14) 48 | 49 | # Get the 14 day Stochastic 50 | # stochastic = stoch(informative, window=14, d=3, k=3, fast=False) 51 | # informative['slowd'] = stochastic['slow_d'] 52 | # informative['slowk'] = stochastic['slow_k'] 53 | 54 | # Get the Ichimoku 55 | ichi = ichimoku(informative, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 56 | informative['tenkan'] = ichi['tenkan_sen'] 57 | informative['kijun'] = ichi['kijun_sen'] 58 | # Calculate rsi of the original dataframe (5m timeframe) 59 | # dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) 60 | 61 | # Use the helper function merge_informative_pair to safely merge the pair 62 | # Automatically renames the columns and merges a shorter timeframe dataframe and a longer timeframe informative pair 63 | # use ffill to have the 1d value available in every row throughout the day. 64 | # Without this, comparisons between columns of the original and the informative pair would only work once per day. 65 | # Full documentation of this method, see below 66 | dataframe = merge_informative_pair(dataframe, informative, self.timeframe, inf_tf, ffill=True) 67 | 68 | # Calculate Stoch of the original dataframe (4h timeframe) 69 | # stochastic = stoch(dataframe, window=14, d=3, k=3, fast=False) 70 | # dataframe['slowd'] = stochastic['slow_d'] 71 | # dataframe['slowk'] = stochastic['slow_k'] 72 | 73 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 74 | # dataframe['chikou_span'] = ichi['chikou_span'] 75 | dataframe['tenkan'] = ichi['tenkan_sen'] 76 | dataframe['kijun'] = ichi['kijun_sen'] 77 | dataframe['senkou_a'] = ichi['senkou_span_a'] 78 | dataframe['senkou_b'] = ichi['senkou_span_b'] 79 | dataframe['cloud_green'] = ichi['cloud_green'] 80 | dataframe['cloud_red'] = ichi['cloud_red'] 81 | 82 | return dataframe 83 | 84 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 85 | dataframe.loc[ 86 | ( 87 | (dataframe['close'] > dataframe['senkou_a']) & 88 | (dataframe['close'] > dataframe['senkou_b']) 89 | ), 90 | 'buy'] = 1 91 | 92 | dataframe.loc[ 93 | ( 94 | (dataframe['close'] > dataframe['senkou_a']) & 95 | (dataframe['close'] > dataframe['senkou_b']) 96 | ), 97 | 'buy'] = 1 98 | 99 | return dataframe 100 | 101 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 102 | (qtpylib.crossed_below(dataframe['tenkan_1d'], dataframe['kijun_1d'])) 103 | 104 | return dataframe 105 | -------------------------------------------------------------------------------- /Ichimoku_v14.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from freqtrade.strategy import IStrategy, merge_informative_pair 3 | from pandas import DataFrame 4 | #from technical.indicators import accumulation_distribution 5 | from technical.util import resample_to_interval, resampled_merge 6 | import talib.abstract as ta 7 | import freqtrade.vendor.qtpylib.indicators as qtpylib 8 | import numpy 9 | from technical.indicators import ichimoku 10 | 11 | class Ichimoku_v14(IStrategy): 12 | """ 13 | 14 | """ 15 | 16 | minimal_roi = { 17 | "0": 10 18 | } 19 | 20 | stoploss = -1 #-0.35 21 | 22 | ticker_interval = '4h' #3m 23 | 24 | # startup_candle_count: int = 2 25 | 26 | # trailing stoploss 27 | #trailing_stop = True 28 | #trailing_stop_positive = 0.40 #0.35 29 | #trailing_stop_positive_offset = 0.50 30 | #trailing_only_offset_is_reached = False 31 | 32 | def informative_pairs(self): 33 | # Optionally Add additional "static" pairs 34 | informative_pairs += [("BTC/USDT", "1d")] 35 | 36 | return informative_pairs 37 | 38 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 39 | if not self.dp: 40 | # Don't do anything if DataProvider is not available. 41 | return dataframe 42 | 43 | inf_tf = '1d' 44 | # Get the informative pair 45 | informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=inf_tf) 46 | # Get the 14 day rsi 47 | # informative['rsi'] = ta.RSI(informative, timeperiod=14) 48 | 49 | # Get the 14 day Stochastic 50 | # stochastic = stoch(informative, window=14, d=3, k=3, fast=False) 51 | # informative['slowd'] = stochastic['slow_d'] 52 | # informative['slowk'] = stochastic['slow_k'] 53 | 54 | # Get the Ichimoku 55 | ichi = ichimoku(informative, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 56 | informative['tenkan'] = ichi['tenkan_sen'] 57 | informative['kijun'] = ichi['kijun_sen'] 58 | # Calculate rsi of the original dataframe (5m timeframe) 59 | # dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) 60 | 61 | # Use the helper function merge_informative_pair to safely merge the pair 62 | # Automatically renames the columns and merges a shorter timeframe dataframe and a longer timeframe informative pair 63 | # use ffill to have the 1d value available in every row throughout the day. 64 | # Without this, comparisons between columns of the original and the informative pair would only work once per day. 65 | # Full documentation of this method, see below 66 | dataframe = merge_informative_pair(dataframe, informative, self.timeframe, inf_tf, ffill=True) 67 | 68 | # Calculate Stoch of the original dataframe (4h timeframe) 69 | # stochastic = stoch(dataframe, window=14, d=3, k=3, fast=False) 70 | # dataframe['slowd'] = stochastic['slow_d'] 71 | # dataframe['slowk'] = stochastic['slow_k'] 72 | 73 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 74 | # dataframe['chikou_span'] = ichi['chikou_span'] 75 | dataframe['tenkan'] = ichi['tenkan_sen'] 76 | dataframe['kijun'] = ichi['kijun_sen'] 77 | dataframe['senkou_a'] = ichi['senkou_span_a'] 78 | dataframe['senkou_b'] = ichi['senkou_span_b'] 79 | dataframe['cloud_green'] = ichi['cloud_green'] 80 | dataframe['cloud_red'] = ichi['cloud_red'] 81 | 82 | return dataframe 83 | 84 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 85 | dataframe.loc[ 86 | ( 87 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_a'])) & 88 | (dataframe['close'] > dataframe['senkou_a']) & 89 | (dataframe['close'] > dataframe['senkou_b']) 90 | ), 91 | 'buy'] = 1 92 | 93 | dataframe.loc[ 94 | ( 95 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_b'])) & 96 | (dataframe['close'] > dataframe['senkou_a']) & 97 | (dataframe['close'] > dataframe['senkou_b']) 98 | ), 99 | 'buy'] = 1 100 | 101 | return dataframe 102 | 103 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 104 | (qtpylib.crossed_below(dataframe['tenkan_1d'], dataframe['kijun_1d'])) 105 | 106 | return dataframe 107 | -------------------------------------------------------------------------------- /Ichimoku_v15_1d.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from freqtrade.strategy import IStrategy, merge_informative_pair 3 | from pandas import DataFrame 4 | #from technical.indicators import accumulation_distribution 5 | from technical.util import resample_to_interval, resampled_merge 6 | import talib.abstract as ta 7 | import freqtrade.vendor.qtpylib.indicators as qtpylib 8 | import numpy 9 | from technical.indicators import ichimoku 10 | 11 | class Ichimoku_v14(IStrategy): 12 | """ 13 | 14 | """ 15 | 16 | minimal_roi = { 17 | "0": 10 18 | } 19 | 20 | stoploss = -1 #-0.35 21 | 22 | ticker_interval = '4h' #3m 23 | 24 | # startup_candle_count: int = 2 25 | 26 | # trailing stoploss 27 | #trailing_stop = True 28 | #trailing_stop_positive = 0.40 #0.35 29 | #trailing_stop_positive_offset = 0.50 30 | #trailing_only_offset_is_reached = False 31 | 32 | def informative_pairs(self): 33 | # Optionally Add additional "static" pairs 34 | informative_pairs += [("BTC/USDT", "1d")] 35 | 36 | return informative_pairs 37 | 38 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 39 | if not self.dp: 40 | # Don't do anything if DataProvider is not available. 41 | return dataframe 42 | 43 | inf_tf = '1d' 44 | # Get the informative pair 45 | informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=inf_tf) 46 | # Get the 14 day rsi 47 | # informative['rsi'] = ta.RSI(informative, timeperiod=14) 48 | 49 | # Get the 14 day Stochastic 50 | # stochastic = stoch(informative, window=14, d=3, k=3, fast=False) 51 | # informative['slowd'] = stochastic['slow_d'] 52 | # informative['slowk'] = stochastic['slow_k'] 53 | 54 | # Get the Ichimoku 55 | ichi = ichimoku(informative, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 56 | informative['tenkan'] = ichi['tenkan_sen'] 57 | informative['kijun'] = ichi['kijun_sen'] 58 | # Calculate rsi of the original dataframe (5m timeframe) 59 | # dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) 60 | 61 | # Use the helper function merge_informative_pair to safely merge the pair 62 | # Automatically renames the columns and merges a shorter timeframe dataframe and a longer timeframe informative pair 63 | # use ffill to have the 1d value available in every row throughout the day. 64 | # Without this, comparisons between columns of the original and the informative pair would only work once per day. 65 | # Full documentation of this method, see below 66 | dataframe = merge_informative_pair(dataframe, informative, self.timeframe, inf_tf, ffill=True) 67 | 68 | # Calculate Stoch of the original dataframe (4h timeframe) 69 | # stochastic = stoch(dataframe, window=14, d=3, k=3, fast=False) 70 | # dataframe['slowd'] = stochastic['slow_d'] 71 | # dataframe['slowk'] = stochastic['slow_k'] 72 | 73 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 74 | # dataframe['chikou_span'] = ichi['chikou_span'] 75 | dataframe['tenkan'] = ichi['tenkan_sen'] 76 | dataframe['kijun'] = ichi['kijun_sen'] 77 | dataframe['senkou_a'] = ichi['senkou_span_a'] 78 | dataframe['senkou_b'] = ichi['senkou_span_b'] 79 | dataframe['cloud_green'] = ichi['cloud_green'] 80 | dataframe['cloud_red'] = ichi['cloud_red'] 81 | 82 | return dataframe 83 | 84 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 85 | dataframe.loc[ 86 | ( 87 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_a'])) & 88 | (dataframe['close'] > dataframe['senkou_a']) & 89 | (dataframe['close'] > dataframe['senkou_b']) 90 | ), 91 | 'buy'] = 1 92 | 93 | dataframe.loc[ 94 | ( 95 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_b'])) & 96 | (dataframe['close'] > dataframe['senkou_a']) & 97 | (dataframe['close'] > dataframe['senkou_b']) 98 | ), 99 | 'buy'] = 1 100 | 101 | return dataframe 102 | 103 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 104 | (qtpylib.crossed_below(dataframe['tenkan_1d'], dataframe['kijun_1d'])) 105 | 106 | return dataframe 107 | -------------------------------------------------------------------------------- /Ichimoku_v16_1d.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v16(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 10 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '1d' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [ 33 | ] 34 | 35 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 36 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 37 | # dataframe['chikou_span'] = ichi['chikou_span'] 38 | dataframe['tenkan'] = ichi['tenkan_sen'] 39 | dataframe['kijun'] = ichi['kijun_sen'] 40 | dataframe['senkou_a'] = ichi['senkou_span_a'] 41 | dataframe['senkou_b'] = ichi['senkou_span_b'] 42 | dataframe['cloud_green'] = ichi['cloud_green'] 43 | dataframe['cloud_red'] = ichi['cloud_red'] 44 | 45 | return dataframe 46 | 47 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 48 | dataframe.loc[ 49 | ( 50 | (qtpylib.crossed_above(dataframe['tenkan'], dataframe['kijun'])) 51 | ), 52 | 'buy'] = 1 53 | 54 | return dataframe 55 | 56 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 57 | dataframe.loc[ 58 | ( 59 | (qtpylib.crossed_above(dataframe['kijun'], dataframe['tenkan'])) 60 | ), 61 | 'sell'] = 1 62 | 63 | return dataframe 64 | -------------------------------------------------------------------------------- /Ichimoku_v17.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v17(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 10 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '1d' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [ 33 | ] 34 | 35 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 36 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 37 | # dataframe['chikou_span'] = ichi['chikou_span'] 38 | dataframe['tenkan'] = ichi['tenkan_sen'] 39 | dataframe['kijun'] = ichi['kijun_sen'] 40 | dataframe['senkou_a'] = ichi['senkou_span_a'] 41 | dataframe['senkou_b'] = ichi['senkou_span_b'] 42 | dataframe['cloud_green'] = ichi['cloud_green'] 43 | dataframe['cloud_red'] = ichi['cloud_red'] 44 | 45 | return dataframe 46 | 47 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 48 | dataframe.loc[ 49 | ( 50 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_a'])) & 51 | (dataframe['close'] > dataframe['senkou_a']) & 52 | (dataframe['close'] > dataframe['senkou_b']) 53 | ), 54 | 'buy'] = 1 55 | 56 | dataframe.loc[ 57 | ( 58 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_b'])) & 59 | (dataframe['close'] > dataframe['senkou_a']) & 60 | (dataframe['close'] > dataframe['senkou_b']) 61 | ), 62 | 'buy'] = 1 63 | 64 | return dataframe 65 | 66 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 67 | dataframe.loc[ 68 | ( 69 | (qtpylib.crossed_above(dataframe['kijun'], dataframe['tenkan'])) 70 | ), 71 | 'sell'] = 1 72 | 73 | return dataframe 74 | -------------------------------------------------------------------------------- /Ichimoku_v18.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from freqtrade.strategy import IStrategy, merge_informative_pair 3 | from pandas import DataFrame 4 | #from technical.indicators import accumulation_distribution 5 | from technical.util import resample_to_interval, resampled_merge 6 | import talib.abstract as ta 7 | import freqtrade.vendor.qtpylib.indicators as qtpylib 8 | import numpy 9 | from technical.indicators import ichimoku 10 | 11 | class Ichimoku_v18(IStrategy): 12 | """ 13 | 14 | """ 15 | 16 | minimal_roi = { 17 | "0": 10 18 | } 19 | 20 | stoploss = -1 #-0.35 21 | 22 | ticker_interval = '4h' #3m 23 | 24 | # startup_candle_count: int = 2 25 | 26 | # trailing stoploss 27 | #trailing_stop = True 28 | #trailing_stop_positive = 0.40 #0.35 29 | #trailing_stop_positive_offset = 0.50 30 | #trailing_only_offset_is_reached = False 31 | 32 | def informative_pairs(self): 33 | # Optionally Add additional "static" pairs 34 | informative_pairs += [("BTC/USDT", "1d")] 35 | 36 | return informative_pairs 37 | 38 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 39 | if not self.dp: 40 | # Don't do anything if DataProvider is not available. 41 | return dataframe 42 | 43 | inf_tf = '1d' 44 | # Get the informative pair 45 | informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=inf_tf) 46 | # Get the 14 day rsi 47 | # informative['rsi'] = ta.RSI(informative, timeperiod=14) 48 | 49 | # Get the 14 day Stochastic 50 | # stochastic = stoch(informative, window=14, d=3, k=3, fast=False) 51 | # informative['slowd'] = stochastic['slow_d'] 52 | # informative['slowk'] = stochastic['slow_k'] 53 | 54 | # Get the Ichimoku 55 | ichi = ichimoku(informative, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 56 | informative['tenkan'] = ichi['tenkan_sen'] 57 | informative['kijun'] = ichi['kijun_sen'] 58 | # Calculate rsi of the original dataframe (5m timeframe) 59 | # dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) 60 | 61 | # Use the helper function merge_informative_pair to safely merge the pair 62 | # Automatically renames the columns and merges a shorter timeframe dataframe and a longer timeframe informative pair 63 | # use ffill to have the 1d value available in every row throughout the day. 64 | # Without this, comparisons between columns of the original and the informative pair would only work once per day. 65 | # Full documentation of this method, see below 66 | dataframe = merge_informative_pair(dataframe, informative, self.timeframe, inf_tf, ffill=True) 67 | 68 | # Calculate Stoch of the original dataframe (4h timeframe) 69 | # stochastic = stoch(dataframe, window=14, d=3, k=3, fast=False) 70 | # dataframe['slowd'] = stochastic['slow_d'] 71 | # dataframe['slowk'] = stochastic['slow_k'] 72 | 73 | ichi = ichimoku(dataframe, conversion_line_period=9, base_line_periods=26, laggin_span=52, displacement=26) 74 | # dataframe['chikou_span'] = ichi['chikou_span'] 75 | dataframe['tenkan'] = ichi['tenkan_sen'] 76 | dataframe['kijun'] = ichi['kijun_sen'] 77 | dataframe['senkou_a'] = ichi['senkou_span_a'] 78 | dataframe['senkou_b'] = ichi['senkou_span_b'] 79 | dataframe['cloud_green'] = ichi['cloud_green'] 80 | dataframe['cloud_red'] = ichi['cloud_red'] 81 | 82 | return dataframe 83 | 84 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 85 | dataframe.loc[ 86 | ( 87 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_a'])) & 88 | (dataframe['close'] > dataframe['senkou_a']) & 89 | (dataframe['close'] > dataframe['senkou_b']) 90 | ), 91 | 'buy'] = 1 92 | 93 | dataframe.loc[ 94 | ( 95 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_b'])) & 96 | (dataframe['close'] > dataframe['senkou_a']) & 97 | (dataframe['close'] > dataframe['senkou_b']) 98 | ), 99 | 'buy'] = 1 100 | 101 | return dataframe 102 | 103 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 104 | (qtpylib.crossed_below(dataframe['tenkan_1d'], dataframe['kijun_1d'])) 105 | 106 | return dataframe 107 | -------------------------------------------------------------------------------- /Ichimoku_v19.py: -------------------------------------------------------------------------------- 1 | # pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement 2 | # --- Do not remove these libs --- 3 | import numpy as np # noqa 4 | import pandas as pd # noqa 5 | from pandas import DataFrame 6 | from freqtrade.strategy.interface import IStrategy 7 | # -------------------------------- 8 | # Add your lib to import here 9 | import talib.abstract as ta 10 | import freqtrade.vendor.qtpylib.indicators as qtpylib 11 | from technical.util import resample_to_interval, resampled_merge 12 | from freqtrade.strategy import IStrategy, merge_informative_pair 13 | from technical.indicators import ichimoku 14 | 15 | class Ichimoku_v19(IStrategy): 16 | 17 | # ROI table: 18 | minimal_roi = { 19 | "0": 10 20 | } 21 | 22 | # Stoploss: 23 | stoploss = -0.99 24 | 25 | # Optimal timeframe for the strategy. 26 | timeframe = '1h' 27 | inf_tf = '4h' 28 | 29 | # Run "populate_indicators()" only for new candle. 30 | process_only_new_candles = True 31 | 32 | # These values can be overridden in the "ask_strategy" section in the config. 33 | use_sell_signal = True 34 | sell_profit_only = False 35 | ignore_roi_if_buy_signal = True 36 | 37 | # Number of candles the strategy requires before producing valid signals 38 | startup_candle_count = 150 39 | 40 | # Optional order type mapping. 41 | order_types = { 42 | 'buy': 'market', 43 | 'sell': 'market', 44 | 'stoploss': 'market', 45 | 'stoploss_on_exchange': False 46 | } 47 | 48 | def informative_pairs(self): 49 | 50 | if not self.dp: 51 | # Don't do anything if DataProvider is not available. 52 | return [] 53 | # Get access to all pairs available in whitelist. 54 | pairs = self.dp.current_whitelist() 55 | # Assign tf to each pair so they can be downloaded and cached for strategy. 56 | informative_pairs = [(pair, '4h') for pair in pairs] 57 | 58 | return informative_pairs 59 | 60 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 61 | 62 | if not self.dp: 63 | # Don't do anything if DataProvider is not available. 64 | return dataframe 65 | 66 | dataframe_inf = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=self.inf_tf) 67 | 68 | #Heiken Ashi Candlestick Data 69 | heikinashi = qtpylib.heikinashi(dataframe_inf) 70 | dataframe_inf['ha_open'] = heikinashi['open'] 71 | dataframe_inf['ha_close'] = heikinashi['close'] 72 | dataframe_inf['ha_high'] = heikinashi['high'] 73 | dataframe_inf['ha_low'] = heikinashi['low'] 74 | 75 | ha_ichi = ichimoku(heikinashi, 76 | conversion_line_period=20, 77 | base_line_periods=60, 78 | laggin_span=120, 79 | displacement=30 80 | ) 81 | 82 | #Required Ichi Parameters 83 | dataframe_inf['senkou_a'] = ha_ichi['senkou_span_a'] 84 | dataframe_inf['senkou_b'] = ha_ichi['senkou_span_b'] 85 | dataframe_inf['cloud_green'] = ha_ichi['cloud_green'] 86 | dataframe_inf['cloud_red'] = ha_ichi['cloud_red'] 87 | 88 | # Merge timeframes 89 | dataframe = merge_informative_pair(dataframe, dataframe_inf, self.timeframe, self.inf_tf, ffill=True) 90 | """ 91 | Senkou Span A > Senkou Span B = Cloud Green 92 | Senkou Span B > Senkou Span A = Cloud Red 93 | """ 94 | return dataframe 95 | 96 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 97 | 98 | dataframe.loc[ 99 | ( 100 | ((dataframe['ha_close_4h'].crossed_above(dataframe['senkou_a_4h'])) & 101 | (dataframe['ha_close_4h'].shift() < (dataframe['senkou_a_4h'])) & 102 | (dataframe['cloud_green_4h'] == True)) | 103 | ((dataframe['ha_close_4h'].crossed_above(dataframe['senkou_b_4h'])) & 104 | (dataframe['ha_close_4h'].shift() < (dataframe['senkou_b_4h'])) & 105 | (dataframe['cloud_red_4h'] == True)) 106 | ), 107 | 'buy'] = 1 108 | 109 | return dataframe 110 | 111 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 112 | 113 | dataframe.loc[ 114 | ( 115 | (dataframe['ha_close_4h'] < dataframe['senkou_a_4h']) | 116 | (dataframe['ha_close_4h'] < dataframe['senkou_b_4h']) 117 | ), 118 | 'sell'] = 1 119 | 120 | return dataframe 121 | -------------------------------------------------------------------------------- /Ichimoku_v2.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v2(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 10 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [ 33 | ] 34 | 35 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 36 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 37 | # dataframe['chikou_span'] = ichi['chikou_span'] 38 | dataframe['tenkan'] = ichi['tenkan_sen'] 39 | dataframe['kijun'] = ichi['kijun_sen'] 40 | dataframe['senkou_a'] = ichi['senkou_span_a'] 41 | dataframe['senkou_b'] = ichi['senkou_span_b'] 42 | dataframe['cloud_green'] = ichi['cloud_green'] 43 | dataframe['cloud_red'] = ichi['cloud_red'] 44 | 45 | return dataframe 46 | 47 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 48 | dataframe.loc[ 49 | ( 50 | (qtpylib.crossed_above(dataframe['senkou_a'], dataframe['senkou_b'])) & 51 | (dataframe['close'] > dataframe['senkou_a']) & 52 | (dataframe['close'] > dataframe['senkou_b']) & 53 | (dataframe['cloud_green'] == True) 54 | ), 55 | 'buy'] = 1 56 | 57 | dataframe.loc[ 58 | ( 59 | (qtpylib.crossed_above(dataframe['tenkan'], dataframe['kijun'])) & 60 | (dataframe['close'] > dataframe['senkou_a']) & 61 | (dataframe['close'] > dataframe['senkou_b']) 62 | ), 63 | 'buy'] = 1 64 | 65 | return dataframe 66 | 67 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 68 | dataframe.loc[ 69 | ( 70 | (qtpylib.crossed_above(dataframe['senkou_b'], dataframe['senkou_a'])) & 71 | (dataframe['close'] < dataframe['senkou_a']) & 72 | (dataframe['close'] < dataframe['senkou_b']) & 73 | (dataframe['cloud_red'] == True) 74 | ), 75 | 'sell'] = 1 76 | 77 | dataframe.loc[ 78 | ( 79 | (qtpylib.crossed_below(dataframe['tenkan'], dataframe['kijun'])) & 80 | (dataframe['cloud_red'] == True) 81 | ), 82 | 'sell'] = 1 83 | 84 | return dataframe 85 | -------------------------------------------------------------------------------- /Ichimoku_v20.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v20(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 10 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [] 33 | 34 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 35 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 36 | # dataframe['chikou_span'] = ichi['chikou_span'] 37 | dataframe['tenkan'] = ichi['tenkan_sen'] 38 | dataframe['kijun'] = ichi['kijun_sen'] 39 | dataframe['senkou_a'] = ichi['senkou_span_a'] 40 | dataframe['senkou_b'] = ichi['senkou_span_b'] 41 | dataframe['cloud_green'] = ichi['cloud_green'] 42 | dataframe['cloud_red'] = ichi['cloud_red'] 43 | 44 | return dataframe 45 | 46 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 47 | dataframe.loc[ 48 | ( 49 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_a'])) & 50 | (dataframe['close'] > dataframe['senkou_a']) & 51 | (dataframe['close'] > dataframe['senkou_b']) & 52 | (dataframe['close'] > dataframe['close'].shift(60)) 53 | 54 | ), 55 | 'buy'] = 1 56 | 57 | dataframe.loc[ 58 | ( 59 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_b'])) & 60 | (dataframe['close'] > dataframe['senkou_a']) & 61 | (dataframe['close'] > dataframe['senkou_b']) & 62 | (dataframe['close'] > dataframe['close'].shift(60)) 63 | ), 64 | 'buy'] = 1 65 | 66 | return dataframe 67 | 68 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 69 | dataframe.loc[ 70 | ( 71 | (qtpylib.crossed_above(dataframe['senkou_b'], dataframe['senkou_a'])) & 72 | (dataframe['close'] < dataframe['senkou_a']) & 73 | (dataframe['close'] < dataframe['senkou_b']) & 74 | (dataframe['cloud_red'] == True) 75 | ), 76 | 'sell'] = 1 77 | 78 | return dataframe 79 | -------------------------------------------------------------------------------- /Ichimoku_v21.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v21(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 10 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [] 33 | 34 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 35 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 36 | # dataframe['chikou_span'] = ichi['chikou_span'] 37 | dataframe['tenkan'] = ichi['tenkan_sen'] 38 | dataframe['kijun'] = ichi['kijun_sen'] 39 | dataframe['senkou_a'] = ichi['senkou_span_a'] 40 | dataframe['senkou_b'] = ichi['senkou_span_b'] 41 | dataframe['cloud_green'] = ichi['cloud_green'] 42 | dataframe['cloud_red'] = ichi['cloud_red'] 43 | 44 | return dataframe 45 | 46 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 47 | dataframe.loc[ 48 | ( 49 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_a'])) & 50 | (dataframe['close'] > dataframe['senkou_a']) & 51 | (dataframe['close'] > dataframe['senkou_b']) & 52 | (dataframe['close'] > dataframe['close'].shift(90)) 53 | 54 | ), 55 | 'buy'] = 1 56 | 57 | dataframe.loc[ 58 | ( 59 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_b'])) & 60 | (dataframe['close'] > dataframe['senkou_a']) & 61 | (dataframe['close'] > dataframe['senkou_b']) & 62 | (dataframe['close'] > dataframe['close'].shift(90)) 63 | ), 64 | 'buy'] = 1 65 | 66 | return dataframe 67 | 68 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 69 | dataframe.loc[ 70 | ( 71 | (qtpylib.crossed_above(dataframe['senkou_b'], dataframe['senkou_a'])) & 72 | (dataframe['close'] < dataframe['senkou_a']) & 73 | (dataframe['close'] < dataframe['senkou_b']) & 74 | (dataframe['cloud_red'] == True) 75 | ), 76 | 'sell'] = 1 77 | 78 | return dataframe 79 | -------------------------------------------------------------------------------- /Ichimoku_v22.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from freqtrade.strategy import IStrategy, merge_informative_pair 3 | from pandas import DataFrame 4 | #from technical.indicators import accumulation_distribution 5 | from technical.util import resample_to_interval, resampled_merge 6 | import talib.abstract as ta 7 | import freqtrade.vendor.qtpylib.indicators as qtpylib 8 | import numpy 9 | from technical.indicators import ichimoku 10 | 11 | class Ichimoku_v22(IStrategy): 12 | """ 13 | 14 | """ 15 | 16 | minimal_roi = { 17 | "0": 100 18 | } 19 | 20 | stoploss = -1 #-0.35 21 | 22 | ticker_interval = '4h' #3m 23 | 24 | # startup_candle_count: int = 2 25 | 26 | # trailing stoploss 27 | #trailing_stop = True 28 | #trailing_stop_positive = 0.40 #0.35 29 | #trailing_stop_positive_offset = 0.50 30 | #trailing_only_offset_is_reached = False 31 | 32 | def informative_pairs(self): 33 | # Optionally Add additional "static" pairs 34 | informative_pairs += [("BTC/USDT", "1d")] 35 | 36 | return informative_pairs 37 | 38 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 39 | if not self.dp: 40 | # Don't do anything if DataProvider is not available. 41 | return dataframe 42 | 43 | inf_tf = '1d' 44 | # Get the informative pair 45 | informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=inf_tf) 46 | # Get the 14 day rsi 47 | # informative['rsi'] = ta.RSI(informative, timeperiod=14) 48 | 49 | # Get the 14 day Stochastic 50 | # stochastic = stoch(informative, window=14, d=3, k=3, fast=False) 51 | # informative['slowd'] = stochastic['slow_d'] 52 | # informative['slowk'] = stochastic['slow_k'] 53 | 54 | # Get the Ichimoku 55 | ichi = ichimoku(informative, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 56 | informative['tenkan'] = ichi['tenkan_sen'] 57 | informative['kijun'] = ichi['kijun_sen'] 58 | # Calculate rsi of the original dataframe (5m timeframe) 59 | # dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) 60 | 61 | # Use the helper function merge_informative_pair to safely merge the pair 62 | # Automatically renames the columns and merges a shorter timeframe dataframe and a longer timeframe informative pair 63 | # use ffill to have the 1d value available in every row throughout the day. 64 | # Without this, comparisons between columns of the original and the informative pair would only work once per day. 65 | # Full documentation of this method, see below 66 | dataframe = merge_informative_pair(dataframe, informative, self.timeframe, inf_tf, ffill=True) 67 | 68 | # Calculate Stoch of the original dataframe (4h timeframe) 69 | # stochastic = stoch(dataframe, window=14, d=3, k=3, fast=False) 70 | # dataframe['slowd'] = stochastic['slow_d'] 71 | # dataframe['slowk'] = stochastic['slow_k'] 72 | 73 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 74 | # dataframe['chikou_span'] = ichi['chikou_span'] 75 | dataframe['tenkan'] = ichi['tenkan_sen'] 76 | dataframe['kijun'] = ichi['kijun_sen'] 77 | dataframe['senkou_a'] = ichi['senkou_span_a'] 78 | dataframe['senkou_b'] = ichi['senkou_span_b'] 79 | dataframe['cloud_green'] = ichi['cloud_green'] 80 | dataframe['cloud_red'] = ichi['cloud_red'] 81 | 82 | return dataframe 83 | 84 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 85 | dataframe.loc[ 86 | ( 87 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_a'])) & 88 | (dataframe['close'] > dataframe['senkou_a']) & 89 | (dataframe['close'] > dataframe['senkou_b']) & 90 | (dataframe['close'] > dataframe['close'].shift(90)) 91 | 92 | ), 93 | 'buy'] = 1 94 | 95 | dataframe.loc[ 96 | ( 97 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_b'])) & 98 | (dataframe['close'] > dataframe['senkou_a']) & 99 | (dataframe['close'] > dataframe['senkou_b']) & 100 | (dataframe['close'] > dataframe['close'].shift(90)) 101 | ), 102 | 'buy'] = 1 103 | 104 | return dataframe 105 | 106 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 107 | (qtpylib.crossed_below(dataframe['tenkan_1d'], dataframe['kijun_1d'])) 108 | 109 | return dataframe 110 | -------------------------------------------------------------------------------- /Ichimoku_v23.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v23(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 100 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [] 33 | 34 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 35 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 36 | # dataframe['chikou_span'] = ichi['chikou_span'] 37 | dataframe['tenkan'] = ichi['tenkan_sen'] 38 | dataframe['kijun'] = ichi['kijun_sen'] 39 | dataframe['senkou_a'] = ichi['senkou_span_a'] 40 | dataframe['senkou_b'] = ichi['senkou_span_b'] 41 | dataframe['cloud_green'] = ichi['cloud_green'] 42 | dataframe['cloud_red'] = ichi['cloud_red'] 43 | 44 | return dataframe 45 | 46 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 47 | dataframe.loc[ 48 | ( 49 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_a'])) & 50 | (dataframe['close'] > dataframe['senkou_a']) & 51 | (dataframe['close'] > dataframe['senkou_b']) & 52 | (dataframe['close'] > dataframe['close'].shift(1)) & 53 | (dataframe['close'].shift(1) > dataframe['close'].shift(2)) 54 | ), 55 | 'buy'] = 1 56 | 57 | dataframe.loc[ 58 | ( 59 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_b'])) & 60 | (dataframe['close'] > dataframe['senkou_a']) & 61 | (dataframe['close'] > dataframe['senkou_b']) & 62 | (dataframe['close'] > dataframe['close'].shift(1)) & 63 | (dataframe['close'].shift(1) > dataframe['close'].shift(2)) 64 | ), 65 | 'buy'] = 1 66 | 67 | return dataframe 68 | 69 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 70 | dataframe.loc[ 71 | ( 72 | (qtpylib.crossed_below(dataframe['tenkan'], dataframe['kijun'])) & 73 | (dataframe['close'] < dataframe['senkou_a']) & 74 | (dataframe['close'] < dataframe['senkou_b']) & 75 | (dataframe['cloud_red'] == True) 76 | ), 77 | 'sell'] = 1 78 | 79 | return dataframe 80 | -------------------------------------------------------------------------------- /Ichimoku_v24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tutecode/freq-strategies/d68211c0d1f6c8265af50f9b03d2a98310f24a55/Ichimoku_v24.png -------------------------------------------------------------------------------- /Ichimoku_v24.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v24(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 100 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [] 33 | 34 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 35 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 36 | # dataframe['chikou_span'] = ichi['chikou_span'] 37 | dataframe['tenkan'] = ichi['tenkan_sen'] 38 | dataframe['kijun'] = ichi['kijun_sen'] 39 | dataframe['senkou_a'] = ichi['senkou_span_a'] 40 | dataframe['senkou_b'] = ichi['senkou_span_b'] 41 | dataframe['cloud_green'] = ichi['cloud_green'] 42 | dataframe['cloud_red'] = ichi['cloud_red'] 43 | 44 | return dataframe 45 | 46 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 47 | dataframe.loc[ 48 | ( 49 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_a'])) & 50 | (dataframe['close'] > dataframe['senkou_a']) & 51 | (dataframe['close'] > dataframe['senkou_b']) & 52 | (dataframe['close'].shift(1) > dataframe['senkou_a']) & 53 | (dataframe['close'].shift(1) > dataframe['senkou_b']) 54 | ), 55 | 'buy'] = 1 56 | 57 | dataframe.loc[ 58 | ( 59 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_b'])) & 60 | (dataframe['close'] > dataframe['senkou_a']) & 61 | (dataframe['close'] > dataframe['senkou_b']) & 62 | (dataframe['close'].shift(1) > dataframe['senkou_a']) & 63 | (dataframe['close'].shift(1) > dataframe['senkou_b']) 64 | ), 65 | 'buy'] = 1 66 | 67 | return dataframe 68 | 69 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 70 | dataframe.loc[ 71 | ( 72 | (qtpylib.crossed_below(dataframe['tenkan'], dataframe['kijun'])) & 73 | (dataframe['close'] < dataframe['senkou_a']) & 74 | (dataframe['close'] < dataframe['senkou_b']) & 75 | (dataframe['cloud_red'] == True) 76 | ), 77 | 'sell'] = 1 78 | 79 | return dataframe 80 | -------------------------------------------------------------------------------- /Ichimoku_v25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tutecode/freq-strategies/d68211c0d1f6c8265af50f9b03d2a98310f24a55/Ichimoku_v25.png -------------------------------------------------------------------------------- /Ichimoku_v25.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v25(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 100 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [] 33 | 34 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 35 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 36 | # dataframe['chikou_span'] = ichi['chikou_span'] 37 | dataframe['tenkan'] = ichi['tenkan_sen'] 38 | dataframe['kijun'] = ichi['kijun_sen'] 39 | dataframe['senkou_a'] = ichi['senkou_span_a'] 40 | dataframe['senkou_b'] = ichi['senkou_span_b'] 41 | dataframe['cloud_green'] = ichi['cloud_green'] 42 | dataframe['cloud_red'] = ichi['cloud_red'] 43 | 44 | return dataframe 45 | 46 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 47 | dataframe.loc[ 48 | ( 49 | (qtpylib.crossed_above(dataframe['close'].shift(2), dataframe['senkou_a'])) & 50 | (dataframe['close'].shift(2) > dataframe['senkou_a']) & 51 | (dataframe['close'].shift(2) > dataframe['senkou_b']) 52 | ), 53 | 'buy'] = 1 54 | 55 | dataframe.loc[ 56 | ( 57 | (qtpylib.crossed_above(dataframe['close'].shift(2), dataframe['senkou_b'])) & 58 | (dataframe['close'].shift(2) > dataframe['senkou_a']) & 59 | (dataframe['close'].shift(2 ) > dataframe['senkou_b']) 60 | ), 61 | 'buy'] = 1 62 | 63 | return dataframe 64 | 65 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 66 | dataframe.loc[ 67 | ( 68 | (qtpylib.crossed_below(dataframe['tenkan'], dataframe['kijun'])) & 69 | (dataframe['close'] < dataframe['senkou_a']) & 70 | (dataframe['close'] < dataframe['senkou_b']) & 71 | (dataframe['cloud_red'] == True) 72 | ), 73 | 'sell'] = 1 74 | 75 | return dataframe 76 | -------------------------------------------------------------------------------- /Ichimoku_v26_1d.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from freqtrade.strategy import IStrategy, merge_informative_pair 3 | from pandas import DataFrame 4 | #from technical.indicators import accumulation_distribution 5 | from technical.util import resample_to_interval, resampled_merge 6 | import talib.abstract as ta 7 | import freqtrade.vendor.qtpylib.indicators as qtpylib 8 | import numpy 9 | from technical.indicators import ichimoku 10 | 11 | class Ichimoku_v26(IStrategy): 12 | """ 13 | 14 | """ 15 | 16 | minimal_roi = { 17 | "0": 100 18 | } 19 | 20 | stoploss = -1 #-0.35 21 | 22 | ticker_interval = '4h' #3m 23 | 24 | # startup_candle_count: int = 2 25 | 26 | # trailing stoploss 27 | #trailing_stop = True 28 | #trailing_stop_positive = 0.40 #0.35 29 | #trailing_stop_positive_offset = 0.50 30 | #trailing_only_offset_is_reached = False 31 | 32 | def informative_pairs(self): 33 | # Optionally Add additional "static" pairs 34 | informative_pairs += [("BTC/USDT", "1d")] 35 | 36 | return informative_pairs 37 | 38 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 39 | if not self.dp: 40 | # Don't do anything if DataProvider is not available. 41 | return dataframe 42 | 43 | inf_tf = '1d' 44 | # Get the informative pair 45 | informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=inf_tf) 46 | # Get the 14 day rsi 47 | # informative['rsi'] = ta.RSI(informative, timeperiod=14) 48 | 49 | # Get the 14 day Stochastic 50 | # stochastic = stoch(informative, window=14, d=3, k=3, fast=False) 51 | # informative['slowd'] = stochastic['slow_d'] 52 | # informative['slowk'] = stochastic['slow_k'] 53 | 54 | # Get the Ichimoku 55 | ichi = ichimoku(informative, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 56 | informative['tenkan'] = ichi['tenkan_sen'] 57 | informative['kijun'] = ichi['kijun_sen'] 58 | # Calculate rsi of the original dataframe (5m timeframe) 59 | # dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) 60 | 61 | # Use the helper function merge_informative_pair to safely merge the pair 62 | # Automatically renames the columns and merges a shorter timeframe dataframe and a longer timeframe informative pair 63 | # use ffill to have the 1d value available in every row throughout the day. 64 | # Without this, comparisons between columns of the original and the informative pair would only work once per day. 65 | # Full documentation of this method, see below 66 | dataframe = merge_informative_pair(dataframe, informative, self.timeframe, inf_tf, ffill=True) 67 | 68 | # Calculate Stoch of the original dataframe (4h timeframe) 69 | # stochastic = stoch(dataframe, window=14, d=3, k=3, fast=False) 70 | # dataframe['slowd'] = stochastic['slow_d'] 71 | # dataframe['slowk'] = stochastic['slow_k'] 72 | 73 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 74 | # dataframe['chikou_span'] = ichi['chikou_span'] 75 | dataframe['tenkan'] = ichi['tenkan_sen'] 76 | dataframe['kijun'] = ichi['kijun_sen'] 77 | dataframe['senkou_a'] = ichi['senkou_span_a'] 78 | dataframe['senkou_b'] = ichi['senkou_span_b'] 79 | dataframe['cloud_green'] = ichi['cloud_green'] 80 | dataframe['cloud_red'] = ichi['cloud_red'] 81 | 82 | return dataframe 83 | 84 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 85 | dataframe.loc[ 86 | ( 87 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_a'])) & 88 | (dataframe['close'] > dataframe['senkou_a']) & 89 | (dataframe['close'] > dataframe['senkou_b']) 90 | ), 91 | 'buy'] = 1 92 | 93 | dataframe.loc[ 94 | ( 95 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_b'])) & 96 | (dataframe['close'] > dataframe['senkou_a']) & 97 | (dataframe['close'] > dataframe['senkou_b']) 98 | ), 99 | 'buy'] = 1 100 | 101 | return dataframe 102 | 103 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 104 | 105 | dataframe.loc[ 106 | ( 107 | (qtpylib.crossed_below(dataframe['tenkan'], dataframe['kijun'])) & 108 | (dataframe['close'] < dataframe['senkou_a']) & 109 | (dataframe['close'] < dataframe['senkou_b']) & 110 | (dataframe['cloud_red'] == True) 111 | ), 112 | 'sell'] = 1 113 | 114 | dataframe.loc[ 115 | ( 116 | (qtpylib.crossed_below(dataframe['tenkan_1d'], dataframe['kijun_1d'])) 117 | ), 118 | 'sell'] = 1 119 | 120 | return dataframe 121 | -------------------------------------------------------------------------------- /Ichimoku_v27_1d.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from freqtrade.strategy import IStrategy, merge_informative_pair 3 | from pandas import DataFrame 4 | #from technical.indicators import accumulation_distribution 5 | from technical.util import resample_to_interval, resampled_merge 6 | import talib.abstract as ta 7 | import freqtrade.vendor.qtpylib.indicators as qtpylib 8 | import numpy 9 | from technical.indicators import ichimoku 10 | 11 | class Ichimoku_v27(IStrategy): 12 | """ 13 | 14 | """ 15 | 16 | minimal_roi = { 17 | "0": 100 18 | } 19 | 20 | stoploss = -1 #-0.35 21 | 22 | ticker_interval = '4h' #3m 23 | 24 | # startup_candle_count: int = 2 25 | 26 | # trailing stoploss 27 | #trailing_stop = True 28 | #trailing_stop_positive = 0.40 #0.35 29 | #trailing_stop_positive_offset = 0.50 30 | #trailing_only_offset_is_reached = False 31 | 32 | def informative_pairs(self): 33 | # Optionally Add additional "static" pairs 34 | informative_pairs += [("ETH/USDT", "1d")] 35 | 36 | return informative_pairs 37 | 38 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 39 | if not self.dp: 40 | # Don't do anything if DataProvider is not available. 41 | return dataframe 42 | 43 | inf_tf = '1d' 44 | # Get the informative pair 45 | informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=inf_tf) 46 | # Get the 14 day rsi 47 | # informative['rsi'] = ta.RSI(informative, timeperiod=14) 48 | 49 | # Get the 14 day Stochastic 50 | # stochastic = stoch(informative, window=14, d=3, k=3, fast=False) 51 | # informative['slowd'] = stochastic['slow_d'] 52 | # informative['slowk'] = stochastic['slow_k'] 53 | 54 | # Get the Ichimoku 55 | ichi = ichimoku(informative, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 56 | informative['tenkan'] = ichi['tenkan_sen'] 57 | informative['kijun'] = ichi['kijun_sen'] 58 | # Calculate rsi of the original dataframe (5m timeframe) 59 | # dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) 60 | 61 | # Use the helper function merge_informative_pair to safely merge the pair 62 | # Automatically renames the columns and merges a shorter timeframe dataframe and a longer timeframe informative pair 63 | # use ffill to have the 1d value available in every row throughout the day. 64 | # Without this, comparisons between columns of the original and the informative pair would only work once per day. 65 | # Full documentation of this method, see below 66 | dataframe = merge_informative_pair(dataframe, informative, self.timeframe, inf_tf, ffill=True) 67 | 68 | # Calculate Stoch of the original dataframe (4h timeframe) 69 | # stochastic = stoch(dataframe, window=14, d=3, k=3, fast=False) 70 | # dataframe['slowd'] = stochastic['slow_d'] 71 | # dataframe['slowk'] = stochastic['slow_k'] 72 | 73 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 74 | # dataframe['chikou_span'] = ichi['chikou_span'] 75 | dataframe['tenkan'] = ichi['tenkan_sen'] 76 | dataframe['kijun'] = ichi['kijun_sen'] 77 | dataframe['senkou_a'] = ichi['senkou_span_a'] 78 | dataframe['senkou_b'] = ichi['senkou_span_b'] 79 | dataframe['cloud_green'] = ichi['cloud_green'] 80 | dataframe['cloud_red'] = ichi['cloud_red'] 81 | 82 | return dataframe 83 | 84 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 85 | dataframe.loc[ 86 | ( 87 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_a'])) & 88 | (dataframe['close'] > dataframe['senkou_a']) & 89 | (dataframe['close'] > dataframe['senkou_b']) 90 | ), 91 | 'buy'] = 1 92 | 93 | dataframe.loc[ 94 | ( 95 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_b'])) & 96 | (dataframe['close'] > dataframe['senkou_a']) & 97 | (dataframe['close'] > dataframe['senkou_b']) 98 | ), 99 | 'buy'] = 1 100 | 101 | return dataframe 102 | 103 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 104 | 105 | dataframe.loc[ 106 | ( 107 | (qtpylib.crossed_below(dataframe['tenkan'], dataframe['kijun'])) & 108 | (dataframe['close'] < dataframe['senkou_a']) & 109 | (dataframe['close'] < dataframe['senkou_b']) & 110 | (dataframe['cloud_red'] == True) 111 | ), 112 | 'sell'] = 1 113 | 114 | dataframe.loc[ 115 | ( 116 | (qtpylib.crossed_below(dataframe['tenkan_1d'], dataframe['kijun_1d'])) 117 | ), 118 | 'sell'] = 1 119 | 120 | return dataframe 121 | -------------------------------------------------------------------------------- /Ichimoku_v28_1d.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from freqtrade.strategy import IStrategy, merge_informative_pair 3 | from pandas import DataFrame 4 | #from technical.indicators import accumulation_distribution 5 | from technical.util import resample_to_interval, resampled_merge 6 | import talib.abstract as ta 7 | import freqtrade.vendor.qtpylib.indicators as qtpylib 8 | import numpy 9 | from technical.indicators import ichimoku 10 | 11 | class Ichimoku_v28(IStrategy): 12 | """ 13 | 14 | """ 15 | 16 | minimal_roi = { 17 | "0": 100 18 | } 19 | 20 | stoploss = -1 #-0.35 21 | 22 | ticker_interval = '4h' #3m 23 | 24 | # startup_candle_count: int = 2 25 | 26 | # trailing stoploss 27 | #trailing_stop = True 28 | #trailing_stop_positive = 0.40 #0.35 29 | #trailing_stop_positive_offset = 0.50 30 | #trailing_only_offset_is_reached = False 31 | 32 | def informative_pairs(self): 33 | # Optionally Add additional "static" pairs 34 | informative_pairs += [("BTC/USDT", "1d")] 35 | 36 | return informative_pairs 37 | 38 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 39 | if not self.dp: 40 | # Don't do anything if DataProvider is not available. 41 | return dataframe 42 | 43 | inf_tf = '1d' 44 | # Get the informative pair 45 | informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=inf_tf) 46 | # Get the 14 day rsi 47 | # informative['rsi'] = ta.RSI(informative, timeperiod=14) 48 | 49 | # Get the 14 day Stochastic 50 | # stochastic = stoch(informative, window=14, d=3, k=3, fast=False) 51 | # informative['slowd'] = stochastic['slow_d'] 52 | # informative['slowk'] = stochastic['slow_k'] 53 | 54 | # Get the Ichimoku 55 | ichi = ichimoku(informative, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 56 | informative['tenkan'] = ichi['tenkan_sen'] 57 | informative['kijun'] = ichi['kijun_sen'] 58 | informative['senkou_a'] = ichi['senkou_span_a'] 59 | informative['senkou_b'] = ichi['senkou_span_b'] 60 | # Calculate rsi of the original dataframe (5m timeframe) 61 | # dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) 62 | 63 | # Use the helper function merge_informative_pair to safely merge the pair 64 | # Automatically renames the columns and merges a shorter timeframe dataframe and a longer timeframe informative pair 65 | # use ffill to have the 1d value available in every row throughout the day. 66 | # Without this, comparisons between columns of the original and the informative pair would only work once per day. 67 | # Full documentation of this method, see below 68 | dataframe = merge_informative_pair(dataframe, informative, self.timeframe, inf_tf, ffill=True) 69 | 70 | # Calculate Stoch of the original dataframe (4h timeframe) 71 | # stochastic = stoch(dataframe, window=14, d=3, k=3, fast=False) 72 | # dataframe['slowd'] = stochastic['slow_d'] 73 | # dataframe['slowk'] = stochastic['slow_k'] 74 | 75 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 76 | # dataframe['chikou_span'] = ichi['chikou_span'] 77 | dataframe['tenkan'] = ichi['tenkan_sen'] 78 | dataframe['kijun'] = ichi['kijun_sen'] 79 | dataframe['senkou_a'] = ichi['senkou_span_a'] 80 | dataframe['senkou_b'] = ichi['senkou_span_b'] 81 | dataframe['cloud_green'] = ichi['cloud_green'] 82 | dataframe['cloud_red'] = ichi['cloud_red'] 83 | 84 | return dataframe 85 | 86 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 87 | dataframe.loc[ 88 | ( 89 | (qtpylib.crossed_above(dataframe['close'].shift(2), dataframe['senkou_a'])) & 90 | (dataframe['close'].shift(2) > dataframe['senkou_a']) & 91 | (dataframe['close'].shift(2) > dataframe['senkou_b']) 92 | ), 93 | 'buy'] = 1 94 | 95 | dataframe.loc[ 96 | ( 97 | (qtpylib.crossed_above(dataframe['close'].shift(2), dataframe['senkou_b'])) & 98 | (dataframe['close'].shift(2) > dataframe['senkou_a']) & 99 | (dataframe['close'].shift(2 ) > dataframe['senkou_b']) 100 | ), 101 | 'buy'] = 1 102 | 103 | return dataframe 104 | 105 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 106 | 107 | dataframe.loc[ 108 | ( 109 | # (qtpylib.crossed_below(dataframe['tenkan_1d'], dataframe['kijun_1d'])) 110 | (qtpylib.crossed_below(dataframe['close_1d'], dataframe['senkou_b_1d'])) & 111 | (dataframe['close_1d'] < dataframe['senkou_a_1d']) & 112 | (dataframe['close_1d'] < dataframe['senkou_b_1d']) 113 | ), 114 | 'sell'] = 1 115 | 116 | dataframe.loc[ 117 | ( 118 | # (qtpylib.crossed_below(dataframe['tenkan_1d'], dataframe['kijun_1d'])) 119 | (qtpylib.crossed_below(dataframe['close_1d'], dataframe['senkou_a_1d'])) & 120 | (dataframe['close_1d'] < dataframe['senkou_a_1d']) & 121 | (dataframe['close_1d'] < dataframe['senkou_b_1d']) 122 | ), 123 | 'sell'] = 1 124 | 125 | return dataframe 126 | -------------------------------------------------------------------------------- /Ichimoku_v29_1d.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from freqtrade.strategy import IStrategy, merge_informative_pair 3 | from pandas import DataFrame 4 | #from technical.indicators import accumulation_distribution 5 | from technical.util import resample_to_interval, resampled_merge 6 | import talib.abstract as ta 7 | import freqtrade.vendor.qtpylib.indicators as qtpylib 8 | import numpy 9 | from technical.indicators import ichimoku 10 | 11 | class Ichimoku_v29(IStrategy): 12 | """ 13 | 14 | """ 15 | 16 | minimal_roi = { 17 | "0": 100 18 | } 19 | 20 | stoploss = -1 #-0.35 21 | 22 | ticker_interval = '4h' #3m 23 | 24 | # startup_candle_count: int = 2 25 | 26 | # trailing stoploss 27 | #trailing_stop = True 28 | #trailing_stop_positive = 0.40 #0.35 29 | #trailing_stop_positive_offset = 0.50 30 | #trailing_only_offset_is_reached = False 31 | 32 | def informative_pairs(self): 33 | # Optionally Add additional "static" pairs 34 | informative_pairs += [("BTC/USDT", "1d")] 35 | 36 | return informative_pairs 37 | 38 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 39 | if not self.dp: 40 | # Don't do anything if DataProvider is not available. 41 | return dataframe 42 | 43 | inf_tf = '1d' 44 | # Get the informative pair 45 | informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=inf_tf) 46 | # Get the 14 day rsi 47 | # informative['rsi'] = ta.RSI(informative, timeperiod=14) 48 | 49 | # Get the 14 day Stochastic 50 | # stochastic = stoch(informative, window=14, d=3, k=3, fast=False) 51 | # informative['slowd'] = stochastic['slow_d'] 52 | # informative['slowk'] = stochastic['slow_k'] 53 | 54 | # Get the Ichimoku 55 | ichi = ichimoku(informative, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 56 | informative['tenkan'] = ichi['tenkan_sen'] 57 | informative['kijun'] = ichi['kijun_sen'] 58 | informative['senkou_a'] = ichi['senkou_span_a'] 59 | informative['senkou_b'] = ichi['senkou_span_b'] 60 | # Calculate rsi of the original dataframe (5m timeframe) 61 | # dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) 62 | 63 | # Pattern Recognition - Bearish candlestick patterns 64 | # # Evening Doji Star: values [0, 100] 65 | informative['CDLEVENINGDOJISTAR'] = ta.CDLEVENINGDOJISTAR(dataframe) 66 | 67 | 68 | # Use the helper function merge_informative_pair to safely merge the pair 69 | # Automatically renames the columns and merges a shorter timeframe dataframe and a longer timeframe informative pair 70 | # use ffill to have the 1d value available in every row throughout the day. 71 | # Without this, comparisons between columns of the original and the informative pair would only work once per day. 72 | # Full documentation of this method, see below 73 | dataframe = merge_informative_pair(dataframe, informative, self.timeframe, inf_tf, ffill=True) 74 | 75 | # Calculate Stoch of the original dataframe (4h timeframe) 76 | # stochastic = stoch(dataframe, window=14, d=3, k=3, fast=False) 77 | # dataframe['slowd'] = stochastic['slow_d'] 78 | # dataframe['slowk'] = stochastic['slow_k'] 79 | 80 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 81 | # dataframe['chikou_span'] = ichi['chikou_span'] 82 | dataframe['tenkan'] = ichi['tenkan_sen'] 83 | dataframe['kijun'] = ichi['kijun_sen'] 84 | dataframe['senkou_a'] = ichi['senkou_span_a'] 85 | dataframe['senkou_b'] = ichi['senkou_span_b'] 86 | dataframe['cloud_green'] = ichi['cloud_green'] 87 | dataframe['cloud_red'] = ichi['cloud_red'] 88 | 89 | return dataframe 90 | 91 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 92 | dataframe.loc[ 93 | ( 94 | (qtpylib.crossed_above(dataframe['close'].shift(2), dataframe['senkou_a'])) & 95 | (dataframe['close'].shift(2) > dataframe['senkou_a']) & 96 | (dataframe['close'].shift(2) > dataframe['senkou_b']) 97 | ), 98 | 'buy'] = 1 99 | 100 | dataframe.loc[ 101 | ( 102 | (qtpylib.crossed_above(dataframe['close'].shift(2), dataframe['senkou_b'])) & 103 | (dataframe['close'].shift(2) > dataframe['senkou_a']) & 104 | (dataframe['close'].shift(2 ) > dataframe['senkou_b']) 105 | ), 106 | 'buy'] = 1 107 | 108 | return dataframe 109 | 110 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 111 | 112 | dataframe.loc[ 113 | ( 114 | # (qtpylib.crossed_below(dataframe['tenkan_1d'], dataframe['kijun_1d'])) 115 | (qtpylib.crossed_below(dataframe['close_1d'], dataframe['senkou_b_1d'])) & 116 | (dataframe['close_1d'] < dataframe['senkou_a_1d']) & 117 | (dataframe['close_1d'] < dataframe['senkou_b_1d']) 118 | ), 119 | 'sell'] = 1 120 | 121 | dataframe.loc[ 122 | ( 123 | # (qtpylib.crossed_below(dataframe['tenkan_1d'], dataframe['kijun_1d'])) 124 | (qtpylib.crossed_below(dataframe['close_1d'], dataframe['senkou_a_1d'])) & 125 | (dataframe['close_1d'] < dataframe['senkou_a_1d']) & 126 | (dataframe['close_1d'] < dataframe['senkou_b_1d']) 127 | ), 128 | 'sell'] = 1 129 | 130 | dataframe.loc[ 131 | ( 132 | (dataframe['CDLEVENINGDOJISTAR_1d'] != 0) 133 | ), 134 | 'sell'] = 1 135 | 136 | return dataframe 137 | -------------------------------------------------------------------------------- /Ichimoku_v3.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v3(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 10 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [ 33 | ] 34 | 35 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 36 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 37 | # dataframe['chikou_span'] = ichi['chikou_span'] 38 | dataframe['tenkan'] = ichi['tenkan_sen'] 39 | dataframe['kijun'] = ichi['kijun_sen'] 40 | dataframe['senkou_a'] = ichi['senkou_span_a'] 41 | dataframe['senkou_b'] = ichi['senkou_span_b'] 42 | dataframe['cloud_green'] = ichi['cloud_green'] 43 | dataframe['cloud_red'] = ichi['cloud_red'] 44 | 45 | return dataframe 46 | 47 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 48 | dataframe.loc[ 49 | ( 50 | (qtpylib.crossed_above(dataframe['tenkan'], dataframe['kijun'])) & 51 | (dataframe['close'] > dataframe['senkou_a']) & 52 | (dataframe['close'] > dataframe['senkou_b']) 53 | ), 54 | 'buy'] = 1 55 | 56 | return dataframe 57 | 58 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 59 | dataframe.loc[ 60 | ( 61 | (qtpylib.crossed_below(dataframe['tenkan'], dataframe['kijun'])) & 62 | (dataframe['cloud_red'] == True) 63 | ), 64 | 'sell'] = 1 65 | 66 | return dataframe 67 | -------------------------------------------------------------------------------- /Ichimoku_v30_DojiStar.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v30(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 100 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [] 33 | 34 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 35 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 36 | # dataframe['chikou_span'] = ichi['chikou_span'] 37 | dataframe['tenkan'] = ichi['tenkan_sen'] 38 | dataframe['kijun'] = ichi['kijun_sen'] 39 | dataframe['senkou_a'] = ichi['senkou_span_a'] 40 | dataframe['senkou_b'] = ichi['senkou_span_b'] 41 | dataframe['cloud_green'] = ichi['cloud_green'] 42 | dataframe['cloud_red'] = ichi['cloud_red'] 43 | 44 | # Pattern Recognition - Bearish candlestick patterns 45 | # # Evening Doji Star: values [0, 100] 46 | dataframe['CDLEVENINGDOJISTAR'] = ta.CDLEVENINGDOJISTAR(dataframe) 47 | 48 | return dataframe 49 | 50 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 51 | dataframe.loc[ 52 | ( 53 | (qtpylib.crossed_above(dataframe['close'].shift(2), dataframe['senkou_a'])) & 54 | (dataframe['close'].shift(2) > dataframe['senkou_a']) & 55 | (dataframe['close'].shift(2) > dataframe['senkou_b']) 56 | ), 57 | 'buy'] = 1 58 | 59 | dataframe.loc[ 60 | ( 61 | (qtpylib.crossed_above(dataframe['close'].shift(2), dataframe['senkou_b'])) & 62 | (dataframe['close'].shift(2) > dataframe['senkou_a']) & 63 | (dataframe['close'].shift(2 ) > dataframe['senkou_b']) 64 | ), 65 | 'buy'] = 1 66 | 67 | return dataframe 68 | 69 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 70 | dataframe.loc[ 71 | ( 72 | (dataframe['CDLEVENINGDOJISTAR'] != 0) 73 | ), 74 | 'sell'] = 1 75 | 76 | return dataframe 77 | -------------------------------------------------------------------------------- /Ichimoku_v31_Heikin.py: -------------------------------------------------------------------------------- 1 | # pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement 2 | # --- Do not remove these libs --- 3 | import numpy as np # noqa 4 | import pandas as pd # noqa 5 | from pandas import DataFrame 6 | from freqtrade.strategy.interface import IStrategy 7 | # -------------------------------- 8 | # Add your lib to import here 9 | import talib.abstract as ta 10 | import freqtrade.vendor.qtpylib.indicators as qtpylib 11 | from technical.util import resample_to_interval, resampled_merge 12 | from freqtrade.strategy import IStrategy, merge_informative_pair 13 | from technical.indicators import ichimoku 14 | 15 | class Ichimoku_v31(IStrategy): 16 | # ROI table: 17 | minimal_roi = { 18 | "0": 100 19 | } 20 | 21 | # Stoploss: 22 | stoploss = -0.99 23 | 24 | # Optimal timeframe for the strategy. 25 | timeframe = '1h' 26 | 27 | inf_tf = '4h' 28 | 29 | # Run "populate_indicators()" only for new candle. 30 | process_only_new_candles = True 31 | 32 | # These values can be overridden in the "ask_strategy" section in the config. 33 | use_sell_signal = True 34 | sell_profit_only = False 35 | ignore_roi_if_buy_signal = True 36 | 37 | # Number of candles the strategy requires before producing valid signals 38 | startup_candle_count = 150 39 | 40 | # Optional order type mapping. 41 | order_types = { 42 | 'buy': 'market', 43 | 'sell': 'market', 44 | 'stoploss': 'market', 45 | 'stoploss_on_exchange': False 46 | } 47 | 48 | def informative_pairs(self): 49 | if not self.dp: 50 | # Don't do anything if DataProvider is not available. 51 | return [] 52 | # Get access to all pairs available in whitelist. 53 | pairs = self.dp.current_whitelist() 54 | # Assign tf to each pair so they can be downloaded and cached for strategy. 55 | informative_pairs = [(pair, '4h') for pair in pairs] 56 | return informative_pairs 57 | 58 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 59 | 60 | if not self.dp: 61 | # Don't do anything if DataProvider is not available. 62 | return dataframe 63 | 64 | dataframe_inf = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=self.inf_tf) 65 | 66 | #Heiken Ashi Candlestick Data 67 | heikinashi = qtpylib.heikinashi(dataframe_inf) 68 | 69 | dataframe_inf['ha_open'] = heikinashi['open'] 70 | dataframe_inf['ha_close'] = heikinashi['close'] 71 | dataframe_inf['ha_high'] = heikinashi['high'] 72 | dataframe_inf['ha_low'] = heikinashi['low'] 73 | 74 | ha_ichi = ichimoku(heikinashi, 75 | conversion_line_period=20, 76 | base_line_periods=60, 77 | laggin_span=120, 78 | displacement=30 79 | ) 80 | 81 | #Required Ichi Parameters 82 | dataframe_inf['senkou_a'] = ha_ichi['senkou_span_a'] 83 | dataframe_inf['senkou_b'] = ha_ichi['senkou_span_b'] 84 | dataframe_inf['cloud_green'] = ha_ichi['cloud_green'] 85 | dataframe_inf['cloud_red'] = ha_ichi['cloud_red'] 86 | 87 | # Merge timeframes 88 | dataframe = merge_informative_pair(dataframe, dataframe_inf, self.timeframe, self.inf_tf, ffill=True) 89 | 90 | """ 91 | Senkou Span A > Senkou Span B = Cloud Green 92 | Senkou Span B > Senkou Span A = Cloud Red 93 | """ 94 | return dataframe 95 | 96 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 97 | dataframe.loc[ 98 | ( 99 | ((dataframe['ha_close_4h'].crossed_above(dataframe['senkou_a_4h'])) & 100 | (dataframe['ha_close_4h'].shift() < (dataframe['senkou_a_4h'])) & 101 | (dataframe['cloud_green_4h'] == True)) | 102 | ((dataframe['ha_close_4h'].crossed_above(dataframe['senkou_b_4h'])) & 103 | (dataframe['ha_close_4h'].shift() < (dataframe['senkou_b_4h'])) & 104 | (dataframe['cloud_red_4h'] == True)) 105 | ), 106 | 'buy'] = 1 107 | 108 | return dataframe 109 | 110 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 111 | dataframe.loc[ 112 | ( 113 | (dataframe['ha_close_4h'] < dataframe['senkou_a_4h']) | 114 | (dataframe['ha_close_4h'] < dataframe['senkou_b_4h']) 115 | ), 116 | 'sell'] = 1 117 | return dataframe 118 | -------------------------------------------------------------------------------- /Ichimoku_v32_HeikinAshi.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v32(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 100 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [] 33 | 34 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 35 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 36 | # dataframe['chikou_span'] = ichi['chikou_span'] 37 | dataframe['tenkan'] = ichi['tenkan_sen'] 38 | dataframe['kijun'] = ichi['kijun_sen'] 39 | dataframe['senkou_a'] = ichi['senkou_span_a'] 40 | dataframe['senkou_b'] = ichi['senkou_span_b'] 41 | dataframe['cloud_green'] = ichi['cloud_green'] 42 | dataframe['cloud_red'] = ichi['cloud_red'] 43 | 44 | 45 | # # Chart type 46 | # # ------------------------------------ 47 | # # Heikin Ashi Strategy 48 | heikinashi = qtpylib.heikinashi(dataframe) 49 | dataframe['ha_open'] = heikinashi['open'] 50 | dataframe['ha_close'] = heikinashi['close'] 51 | dataframe['ha_high'] = heikinashi['high'] 52 | dataframe['ha_low'] = heikinashi['low'] 53 | 54 | return dataframe 55 | 56 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 57 | dataframe.loc[ 58 | ( 59 | (qtpylib.crossed_above(dataframe['ha_close'].shift(2), dataframe['senkou_a'])) & 60 | (dataframe['ha_close'].shift(2) > dataframe['senkou_a']) & 61 | (dataframe['ha_close'].shift(2) > dataframe['senkou_b']) 62 | ), 63 | 'buy'] = 1 64 | 65 | dataframe.loc[ 66 | ( 67 | (qtpylib.crossed_above(dataframe['ha_close'].shift(2), dataframe['senkou_b'])) & 68 | (dataframe['ha_close'].shift(2) > dataframe['senkou_a']) & 69 | (dataframe['ha_close'].shift(2 ) > dataframe['senkou_b']) 70 | ), 71 | 'buy'] = 1 72 | 73 | return dataframe 74 | 75 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 76 | dataframe.loc[ 77 | ( 78 | (qtpylib.crossed_below(dataframe['tenkan'], dataframe['kijun'])) & 79 | (dataframe['ha_close'] < dataframe['senkou_a']) & 80 | (dataframe['ha_close'] < dataframe['senkou_b']) & 81 | (dataframe['cloud_red'] == True) 82 | ), 83 | 'sell'] = 1 84 | 85 | return dataframe 86 | -------------------------------------------------------------------------------- /Ichimoku_v33_SAR.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v33(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 100 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [] 33 | 34 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 35 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 36 | # dataframe['chikou_span'] = ichi['chikou_span'] 37 | dataframe['tenkan'] = ichi['tenkan_sen'] 38 | dataframe['kijun'] = ichi['kijun_sen'] 39 | dataframe['senkou_a'] = ichi['senkou_span_a'] 40 | dataframe['senkou_b'] = ichi['senkou_span_b'] 41 | dataframe['cloud_green'] = ichi['cloud_green'] 42 | dataframe['cloud_red'] = ichi['cloud_red'] 43 | 44 | # Parabolic SAR 45 | dataframe['sar'] = ta.SAR(dataframe) 46 | 47 | return dataframe 48 | 49 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 50 | dataframe.loc[ 51 | ( 52 | (qtpylib.crossed_above(dataframe['close'].shift(2), dataframe['senkou_a'])) & 53 | (dataframe['close'].shift(2) > dataframe['senkou_a']) & 54 | (dataframe['close'].shift(2) > dataframe['senkou_b']) 55 | ), 56 | 'buy'] = 1 57 | 58 | dataframe.loc[ 59 | ( 60 | (qtpylib.crossed_above(dataframe['close'].shift(2), dataframe['senkou_b'])) & 61 | (dataframe['close'].shift(2) > dataframe['senkou_a']) & 62 | (dataframe['close'].shift(2 ) > dataframe['senkou_b']) 63 | ), 64 | 'buy'] = 1 65 | 66 | return dataframe 67 | 68 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 69 | dataframe.loc[ 70 | ( 71 | (qtpylib.crossed_below(dataframe['tenkan'], dataframe['kijun'])) & 72 | (dataframe['close'] < dataframe['senkou_a']) & 73 | (dataframe['close'] < dataframe['senkou_b']) & 74 | (dataframe['cloud_red'] == True) 75 | ), 76 | 'sell'] = 1 77 | 78 | dataframe.loc[ 79 | ( 80 | (dataframe['close'] < dataframe['sar']) 81 | ), 82 | 'sell'] = 1 83 | 84 | return dataframe 85 | -------------------------------------------------------------------------------- /Ichimoku_v34.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v34(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 100 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [] 33 | 34 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 35 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 36 | # dataframe['chikou_span'] = ichi['chikou_span'] 37 | dataframe['tenkan'] = ichi['tenkan_sen'] 38 | dataframe['kijun'] = ichi['kijun_sen'] 39 | dataframe['senkou_a'] = ichi['senkou_span_a'] 40 | dataframe['senkou_b'] = ichi['senkou_span_b'] 41 | dataframe['cloud_green'] = ichi['cloud_green'] 42 | dataframe['cloud_red'] = ichi['cloud_red'] 43 | 44 | return dataframe 45 | 46 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 47 | dataframe.loc[ 48 | ( 49 | (qtpylib.crossed_above(dataframe['close'].shift(2), dataframe['senkou_a'])) & 50 | (dataframe['close'].shift(2) > dataframe['senkou_a']) & 51 | (dataframe['close'].shift(2) > dataframe['senkou_b']) 52 | ), 53 | 'buy'] = 1 54 | 55 | dataframe.loc[ 56 | ( 57 | (qtpylib.crossed_above(dataframe['close'].shift(2), dataframe['senkou_b'])) & 58 | (dataframe['close'].shift(2) > dataframe['senkou_a']) & 59 | (dataframe['close'].shift(2 ) > dataframe['senkou_b']) 60 | ), 61 | 'buy'] = 1 62 | 63 | return dataframe 64 | 65 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 66 | dataframe.loc[ 67 | ( 68 | (qtpylib.crossed_below(dataframe['close'].shift(3), dataframe['kijun'])) & 69 | (dataframe['close'] < dataframe['kijun']) 70 | ), 71 | 'sell'] = 1 72 | 73 | return dataframe 74 | -------------------------------------------------------------------------------- /Ichimoku_v35_SAR_1d.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from freqtrade.strategy import IStrategy, merge_informative_pair 3 | from pandas import DataFrame 4 | #from technical.indicators import accumulation_distribution 5 | from technical.util import resample_to_interval, resampled_merge 6 | import talib.abstract as ta 7 | import freqtrade.vendor.qtpylib.indicators as qtpylib 8 | import numpy 9 | from technical.indicators import ichimoku 10 | 11 | class Ichimoku_v35(IStrategy): 12 | """ 13 | 14 | """ 15 | 16 | minimal_roi = { 17 | "0": 100 18 | } 19 | 20 | stoploss = -1 #-0.35 21 | 22 | ticker_interval = '4h' #3m 23 | 24 | # startup_candle_count: int = 2 25 | 26 | # trailing stoploss 27 | #trailing_stop = True 28 | #trailing_stop_positive = 0.40 #0.35 29 | #trailing_stop_positive_offset = 0.50 30 | #trailing_only_offset_is_reached = False 31 | 32 | def informative_pairs(self): 33 | # Optionally Add additional "static" pairs 34 | informative_pairs += [(pair, '1d') for pair in pairs] # [("BTC/USDT", "1d")] 35 | 36 | return informative_pairs 37 | 38 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 39 | if not self.dp: 40 | # Don't do anything if DataProvider is not available. 41 | return dataframe 42 | 43 | inf_tf = '1d' 44 | # Get the informative pair 45 | informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=inf_tf) 46 | # Get the 14 day rsi 47 | # informative['rsi'] = ta.RSI(informative, timeperiod=14) 48 | 49 | # Get the 14 day Stochastic 50 | # stochastic = stoch(informative, window=14, d=3, k=3, fast=False) 51 | # informative['slowd'] = stochastic['slow_d'] 52 | # informative['slowk'] = stochastic['slow_k'] 53 | 54 | # Get the Ichimoku 55 | ichi = ichimoku(informative, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 56 | informative['tenkan'] = ichi['tenkan_sen'] 57 | informative['kijun'] = ichi['kijun_sen'] 58 | informative['senkou_a'] = ichi['senkou_span_a'] 59 | informative['senkou_b'] = ichi['senkou_span_b'] 60 | # Calculate rsi of the original dataframe (5m timeframe) 61 | # dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) 62 | 63 | # Pattern Recognition - Bearish candlestick patterns 64 | # # Evening Doji Star: values [0, 100] 65 | informative['CDLEVENINGDOJISTAR'] = ta.CDLEVENINGDOJISTAR(dataframe) 66 | 67 | # Parabolic SAR 68 | informative['sar'] = ta.SAR(dataframe) 69 | 70 | # Use the helper function merge_informative_pair to safely merge the pair 71 | # Automatically renames the columns and merges a shorter timeframe dataframe and a longer timeframe informative pair 72 | # use ffill to have the 1d value available in every row throughout the day. 73 | # Without this, comparisons between columns of the original and the informative pair would only work once per day. 74 | # Full documentation of this method, see below 75 | dataframe = merge_informative_pair(dataframe, informative, self.timeframe, inf_tf, ffill=True) 76 | 77 | # Calculate Stoch of the original dataframe (4h timeframe) 78 | # stochastic = stoch(dataframe, window=14, d=3, k=3, fast=False) 79 | # dataframe['slowd'] = stochastic['slow_d'] 80 | # dataframe['slowk'] = stochastic['slow_k'] 81 | 82 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 83 | # dataframe['chikou_span'] = ichi['chikou_span'] 84 | dataframe['tenkan'] = ichi['tenkan_sen'] 85 | dataframe['kijun'] = ichi['kijun_sen'] 86 | dataframe['senkou_a'] = ichi['senkou_span_a'] 87 | dataframe['senkou_b'] = ichi['senkou_span_b'] 88 | dataframe['cloud_green'] = ichi['cloud_green'] 89 | dataframe['cloud_red'] = ichi['cloud_red'] 90 | 91 | return dataframe 92 | 93 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 94 | dataframe.loc[ 95 | ( 96 | (qtpylib.crossed_above(dataframe['close'].shift(2), dataframe['senkou_a'])) & 97 | (dataframe['close'].shift(2) > dataframe['senkou_a']) & 98 | (dataframe['close'].shift(2) > dataframe['senkou_b']) 99 | ), 100 | 'buy'] = 1 101 | 102 | dataframe.loc[ 103 | ( 104 | (qtpylib.crossed_above(dataframe['close'].shift(2), dataframe['senkou_b'])) & 105 | (dataframe['close'].shift(2) > dataframe['senkou_a']) & 106 | (dataframe['close'].shift(2 ) > dataframe['senkou_b']) 107 | ), 108 | 'buy'] = 1 109 | 110 | return dataframe 111 | 112 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 113 | dataframe.loc[ 114 | ( 115 | (dataframe['close_1d'] < dataframe['sar_1d']) 116 | ), 117 | 'sell'] = 1 118 | 119 | return dataframe 120 | -------------------------------------------------------------------------------- /Ichimoku_v36_SAR_1s.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from freqtrade.strategy import IStrategy, merge_informative_pair 3 | from pandas import DataFrame 4 | #from technical.indicators import accumulation_distribution 5 | from technical.util import resample_to_interval, resampled_merge 6 | import talib.abstract as ta 7 | import freqtrade.vendor.qtpylib.indicators as qtpylib 8 | import numpy 9 | from technical.indicators import ichimoku 10 | 11 | class Ichimoku_v36(IStrategy): 12 | """ 13 | 14 | """ 15 | 16 | minimal_roi = { 17 | "0": 100 18 | } 19 | 20 | stoploss = -1 #-0.35 21 | 22 | ticker_interval = '4h' #3m 23 | 24 | # startup_candle_count: int = 2 25 | 26 | # trailing stoploss 27 | #trailing_stop = True 28 | #trailing_stop_positive = 0.40 #0.35 29 | #trailing_stop_positive_offset = 0.50 30 | #trailing_only_offset_is_reached = False 31 | 32 | def informative_pairs(self): 33 | # Optionally Add additional "static" pairs 34 | informative_pairs += [(pair, '1w') for pair in pairs] # [("BTC/USDT", "1d")] 35 | 36 | return informative_pairs 37 | 38 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 39 | if not self.dp: 40 | # Don't do anything if DataProvider is not available. 41 | return dataframe 42 | 43 | inf_tf = '1w' 44 | # Get the informative pair 45 | informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=inf_tf) 46 | # Get the 14 day rsi 47 | # informative['rsi'] = ta.RSI(informative, timeperiod=14) 48 | 49 | # Get the 14 day Stochastic 50 | # stochastic = stoch(informative, window=14, d=3, k=3, fast=False) 51 | # informative['slowd'] = stochastic['slow_d'] 52 | # informative['slowk'] = stochastic['slow_k'] 53 | 54 | # Get the Ichimoku 55 | ichi = ichimoku(informative, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 56 | informative['tenkan'] = ichi['tenkan_sen'] 57 | informative['kijun'] = ichi['kijun_sen'] 58 | informative['senkou_a'] = ichi['senkou_span_a'] 59 | informative['senkou_b'] = ichi['senkou_span_b'] 60 | # Calculate rsi of the original dataframe (5m timeframe) 61 | # dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) 62 | 63 | # Pattern Recognition - Bearish candlestick patterns 64 | # # Evening Doji Star: values [0, 100] 65 | informative['CDLEVENINGDOJISTAR'] = ta.CDLEVENINGDOJISTAR(dataframe) 66 | 67 | # Parabolic SAR 68 | informative['sar'] = ta.SAR(dataframe) 69 | 70 | # Use the helper function merge_informative_pair to safely merge the pair 71 | # Automatically renames the columns and merges a shorter timeframe dataframe and a longer timeframe informative pair 72 | # use ffill to have the 1d value available in every row throughout the day. 73 | # Without this, comparisons between columns of the original and the informative pair would only work once per day. 74 | # Full documentation of this method, see below 75 | dataframe = merge_informative_pair(dataframe, informative, self.timeframe, inf_tf, ffill=True) 76 | 77 | # Calculate Stoch of the original dataframe (4h timeframe) 78 | # stochastic = stoch(dataframe, window=14, d=3, k=3, fast=False) 79 | # dataframe['slowd'] = stochastic['slow_d'] 80 | # dataframe['slowk'] = stochastic['slow_k'] 81 | 82 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 83 | # dataframe['chikou_span'] = ichi['chikou_span'] 84 | dataframe['tenkan'] = ichi['tenkan_sen'] 85 | dataframe['kijun'] = ichi['kijun_sen'] 86 | dataframe['senkou_a'] = ichi['senkou_span_a'] 87 | dataframe['senkou_b'] = ichi['senkou_span_b'] 88 | dataframe['cloud_green'] = ichi['cloud_green'] 89 | dataframe['cloud_red'] = ichi['cloud_red'] 90 | 91 | return dataframe 92 | 93 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 94 | dataframe.loc[ 95 | ( 96 | (qtpylib.crossed_above(dataframe['close'].shift(2), dataframe['senkou_a'])) & 97 | (dataframe['close'].shift(2) > dataframe['senkou_a']) & 98 | (dataframe['close'].shift(2) > dataframe['senkou_b']) 99 | ), 100 | 'buy'] = 1 101 | 102 | dataframe.loc[ 103 | ( 104 | (qtpylib.crossed_above(dataframe['close'].shift(2), dataframe['senkou_b'])) & 105 | (dataframe['close'].shift(2) > dataframe['senkou_a']) & 106 | (dataframe['close'].shift(2 ) > dataframe['senkou_b']) 107 | ), 108 | 'buy'] = 1 109 | 110 | return dataframe 111 | 112 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 113 | 114 | dataframe.loc[ 115 | ( 116 | (dataframe['close_1w'] < dataframe['sar_1w']) 117 | ), 118 | 'sell'] = 1 119 | 120 | return dataframe 121 | -------------------------------------------------------------------------------- /Ichimoku_v37_HeikinAshi.py: -------------------------------------------------------------------------------- 1 | # pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement 2 | # --- Do not remove these libs --- 3 | import numpy as np # noqa 4 | import pandas as pd # noqa 5 | from pandas import DataFrame 6 | from freqtrade.strategy.interface import IStrategy 7 | # -------------------------------- 8 | # Add your lib to import here 9 | import talib.abstract as ta 10 | import freqtrade.vendor.qtpylib.indicators as qtpylib 11 | from technical.util import resample_to_interval, resampled_merge 12 | from freqtrade.strategy import IStrategy, merge_informative_pair 13 | from technical.indicators import ichimoku 14 | 15 | class Ichimoku_v37(IStrategy): 16 | # ROI table: 17 | minimal_roi = { 18 | "0": 100 19 | } 20 | 21 | # Stoploss: 22 | stoploss = -0.99 23 | 24 | # Optimal timeframe for the strategy. 25 | timeframe = '4h' 26 | 27 | inf_tf = '1d' 28 | 29 | # Run "populate_indicators()" only for new candle. 30 | process_only_new_candles = True 31 | 32 | # These values can be overridden in the "ask_strategy" section in the config. 33 | use_sell_signal = True 34 | sell_profit_only = False 35 | ignore_roi_if_buy_signal = True 36 | 37 | # Number of candles the strategy requires before producing valid signals 38 | startup_candle_count = 150 39 | 40 | # Optional order type mapping. 41 | order_types = { 42 | 'buy': 'market', 43 | 'sell': 'market', 44 | 'stoploss': 'market', 45 | 'stoploss_on_exchange': False 46 | } 47 | 48 | def informative_pairs(self): 49 | if not self.dp: 50 | # Don't do anything if DataProvider is not available. 51 | return [] 52 | # Get access to all pairs available in whitelist. 53 | pairs = self.dp.current_whitelist() 54 | # Assign tf to each pair so they can be downloaded and cached for strategy. 55 | informative_pairs = [(pair, '1d') for pair in pairs] 56 | return informative_pairs 57 | 58 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 59 | 60 | if not self.dp: 61 | # Don't do anything if DataProvider is not available. 62 | return dataframe 63 | 64 | dataframe_inf = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=self.inf_tf) 65 | 66 | #Heiken Ashi Candlestick Data 67 | heikinashi = qtpylib.heikinashi(dataframe_inf) 68 | heik = qtpylib.heikinashi(dataframe) 69 | 70 | dataframe_inf['ha_open'] = heikinashi['open'] 71 | dataframe_inf['ha_close'] = heikinashi['close'] 72 | dataframe_inf['ha_high'] = heikinashi['high'] 73 | dataframe_inf['ha_low'] = heikinashi['low'] 74 | 75 | dataframe['ha_4h_open'] = heik['open'] 76 | dataframe['ha_4h_close'] = heik['close'] 77 | dataframe['ha_4h_high'] = heik['high'] 78 | dataframe['ha_4h_low'] = heik['low'] 79 | 80 | ha_ichi = ichimoku(heikinashi, 81 | conversion_line_period=20, 82 | base_line_periods=60, 83 | laggin_span=120, 84 | displacement=30 85 | ) 86 | 87 | #Required Ichi Parameters 88 | dataframe_inf['senkou_a'] = ha_ichi['senkou_span_a'] 89 | dataframe_inf['senkou_b'] = ha_ichi['senkou_span_b'] 90 | dataframe_inf['cloud_green'] = ha_ichi['cloud_green'] 91 | dataframe_inf['cloud_red'] = ha_ichi['cloud_red'] 92 | 93 | # Merge timeframes 94 | dataframe = merge_informative_pair(dataframe, dataframe_inf, self.timeframe, self.inf_tf, ffill=True) 95 | 96 | """ 97 | Senkou Span A > Senkou Span B = Cloud Green 98 | Senkou Span B > Senkou Span A = Cloud Red 99 | """ 100 | return dataframe 101 | 102 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 103 | dataframe.loc[ 104 | ( 105 | ( 106 | (dataframe['ha_4h_close'].crossed_above(dataframe['senkou_a_1d'])) & 107 | (dataframe['ha_4h_close'].shift() < (dataframe['senkou_a_1d'])) & 108 | (dataframe['cloud_green_1d'] == True) 109 | ) | 110 | ( 111 | (dataframe['ha_4h_close'].crossed_above(dataframe['senkou_b_1d'])) & 112 | (dataframe['ha_4h_close'].shift() < (dataframe['senkou_b_1d'])) & 113 | (dataframe['cloud_red_1d'] == True) 114 | ) 115 | ), 116 | 'buy'] = 1 117 | 118 | return dataframe 119 | 120 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 121 | dataframe.loc[ 122 | ( 123 | (dataframe['ha_4h_close'] < dataframe['senkou_a_1d']) | 124 | (dataframe['ha_4h_close'] < dataframe['senkou_b_1d']) 125 | ), 126 | 'sell'] = 1 127 | 128 | return dataframe 129 | -------------------------------------------------------------------------------- /Ichimoku_v38_HeikinAshi.py: -------------------------------------------------------------------------------- 1 | # pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement 2 | # --- Do not remove these libs --- 3 | import numpy as np # noqa 4 | import pandas as pd # noqa 5 | from pandas import DataFrame 6 | from freqtrade.strategy.interface import IStrategy 7 | # -------------------------------- 8 | # Add your lib to import here 9 | import talib.abstract as ta 10 | import freqtrade.vendor.qtpylib.indicators as qtpylib 11 | from technical.util import resample_to_interval, resampled_merge 12 | from freqtrade.strategy import IStrategy, merge_informative_pair 13 | from technical.indicators import ichimoku 14 | 15 | class Ichimoku_v38(IStrategy): 16 | # ROI table: 17 | minimal_roi = { 18 | "0": 100 19 | } 20 | 21 | # Stoploss: 22 | stoploss = -0.99 23 | 24 | # Optimal timeframe for the strategy. 25 | timeframe = '4h' 26 | 27 | inf_tf = '1d' 28 | 29 | # Run "populate_indicators()" only for new candle. 30 | process_only_new_candles = True 31 | 32 | # These values can be overridden in the "ask_strategy" section in the config. 33 | use_sell_signal = True 34 | sell_profit_only = False 35 | ignore_roi_if_buy_signal = True 36 | 37 | # Number of candles the strategy requires before producing valid signals 38 | startup_candle_count = 150 39 | 40 | # Optional order type mapping. 41 | order_types = { 42 | 'buy': 'market', 43 | 'sell': 'market', 44 | 'stoploss': 'market', 45 | 'stoploss_on_exchange': False 46 | } 47 | 48 | def informative_pairs(self): 49 | if not self.dp: 50 | # Don't do anything if DataProvider is not available. 51 | return [] 52 | # Get access to all pairs available in whitelist. 53 | pairs = self.dp.current_whitelist() 54 | # Assign tf to each pair so they can be downloaded and cached for strategy. 55 | informative_pairs = [(pair, '1d') for pair in pairs] 56 | return informative_pairs 57 | 58 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 59 | 60 | if not self.dp: 61 | # Don't do anything if DataProvider is not available. 62 | return dataframe 63 | 64 | dataframe_inf = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=self.inf_tf) 65 | 66 | #Heiken Ashi Candlestick Data 67 | heikinashi = qtpylib.heikinashi(dataframe_inf) 68 | 69 | dataframe_inf['ha_open'] = heikinashi['open'] 70 | dataframe_inf['ha_close'] = heikinashi['close'] 71 | dataframe_inf['ha_high'] = heikinashi['high'] 72 | dataframe_inf['ha_low'] = heikinashi['low'] 73 | 74 | ha_ichi = ichimoku(heikinashi, 75 | conversion_line_period=20, 76 | base_line_periods=60, 77 | laggin_span=120, 78 | displacement=30 79 | ) 80 | 81 | #Required Ichi Parameters 82 | dataframe_inf['senkou_a'] = ha_ichi['senkou_span_a'] 83 | dataframe_inf['senkou_b'] = ha_ichi['senkou_span_b'] 84 | dataframe_inf['cloud_green'] = ha_ichi['cloud_green'] 85 | dataframe_inf['cloud_red'] = ha_ichi['cloud_red'] 86 | 87 | # Merge timeframes 88 | dataframe = merge_informative_pair(dataframe, dataframe_inf, self.timeframe, self.inf_tf, ffill=True) 89 | 90 | """ 91 | Senkou Span A > Senkou Span B = Cloud Green 92 | Senkou Span B > Senkou Span A = Cloud Red 93 | """ 94 | return dataframe 95 | 96 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 97 | dataframe.loc[ 98 | ( 99 | ( 100 | (dataframe['ha_close_1d'].crossed_above(dataframe['senkou_a_1d'])) & 101 | (dataframe['ha_close_1d'].shift() < (dataframe['senkou_a_1d'])) & 102 | (dataframe['cloud_green_1d'] == True) 103 | ) | 104 | ( 105 | (dataframe['ha_close_1d'].crossed_above(dataframe['senkou_b_1d'])) & 106 | (dataframe['ha_close_1d'].shift() < (dataframe['senkou_b_1d'])) & 107 | (dataframe['cloud_red_1d'] == True) 108 | ) 109 | ), 110 | 'buy'] = 1 111 | 112 | return dataframe 113 | 114 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 115 | dataframe.loc[ 116 | ( 117 | (dataframe['ha_close_1d'] < dataframe['senkou_a_1d']) | 118 | (dataframe['ha_close_1d'] < dataframe['senkou_b_1d']) 119 | ), 120 | 'sell'] = 1 121 | return dataframe 122 | -------------------------------------------------------------------------------- /Ichimoku_v4.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v4(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 100 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [ 33 | ] 34 | 35 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 36 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 37 | # dataframe['chikou_span'] = ichi['chikou_span'] 38 | dataframe['tenkan'] = ichi['tenkan_sen'] 39 | dataframe['kijun'] = ichi['kijun_sen'] 40 | dataframe['senkou_a'] = ichi['senkou_span_a'] 41 | dataframe['senkou_b'] = ichi['senkou_span_b'] 42 | dataframe['cloud_green'] = ichi['cloud_green'] 43 | dataframe['cloud_red'] = ichi['cloud_red'] 44 | 45 | return dataframe 46 | 47 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 48 | dataframe.loc[ 49 | ( 50 | (qtpylib.crossed_above(dataframe['tenkan'], dataframe['kijun'])) & 51 | (dataframe['close'] > dataframe['senkou_a']) & 52 | (dataframe['close'] > dataframe['senkou_b']) 53 | ), 54 | 'buy'] = 1 55 | 56 | return dataframe 57 | 58 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 59 | dataframe.loc[ 60 | ( 61 | (qtpylib.crossed_below(dataframe['tenkan'], dataframe['kijun'])) & 62 | (dataframe['cloud_red'] == True) 63 | ), 64 | 'sell'] = 1 65 | 66 | return dataframe 67 | -------------------------------------------------------------------------------- /Ichimoku_v5.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v5(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 100 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [ 33 | ] 34 | 35 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 36 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 37 | # dataframe['chikou_span'] = ichi['chikou_span'] 38 | dataframe['tenkan'] = ichi['tenkan_sen'] 39 | dataframe['kijun'] = ichi['kijun_sen'] 40 | dataframe['senkou_a'] = ichi['senkou_span_a'] 41 | dataframe['senkou_b'] = ichi['senkou_span_b'] 42 | dataframe['cloud_green'] = ichi['cloud_green'] 43 | dataframe['cloud_red'] = ichi['cloud_red'] 44 | 45 | return dataframe 46 | 47 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 48 | dataframe.loc[ 49 | ( 50 | (qtpylib.crossed_above(dataframe['tenkan'], dataframe['kijun'])) & 51 | (dataframe['close'] > dataframe['senkou_a']) & 52 | (dataframe['close'] > dataframe['senkou_b']) 53 | ), 54 | 'buy'] = 1 55 | 56 | return dataframe 57 | 58 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 59 | dataframe.loc[ 60 | ( 61 | (qtpylib.crossed_below(dataframe['tenkan'], dataframe['kijun'])) 62 | #(dataframe['cloud_red'] == True) 63 | ), 64 | 'sell'] = 1 65 | 66 | return dataframe 67 | -------------------------------------------------------------------------------- /Ichimoku_v6.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v6(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 100 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [] 33 | 34 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 35 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 36 | # dataframe['chikou_span'] = ichi['chikou_span'] 37 | dataframe['tenkan'] = ichi['tenkan_sen'] 38 | dataframe['kijun'] = ichi['kijun_sen'] 39 | dataframe['senkou_a'] = ichi['senkou_span_a'] 40 | dataframe['senkou_b'] = ichi['senkou_span_b'] 41 | dataframe['cloud_green'] = ichi['cloud_green'] 42 | dataframe['cloud_red'] = ichi['cloud_red'] 43 | 44 | return dataframe 45 | 46 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 47 | dataframe.loc[ 48 | ( 49 | (qtpylib.crossed_above(dataframe['tenkan'], dataframe['kijun'])) & 50 | (dataframe['close'] > dataframe['senkou_a']) & 51 | (dataframe['close'] > dataframe['senkou_b']) 52 | ), 53 | 'buy'] = 1 54 | 55 | return dataframe 56 | 57 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 58 | dataframe.loc[ 59 | ( 60 | (qtpylib.crossed_below(dataframe['tenkan'], dataframe['kijun'])) & 61 | (dataframe['close'] < dataframe['senkou_a']) & 62 | (dataframe['close'] < dataframe['senkou_b']) & 63 | (dataframe['cloud_red'] == True) 64 | ), 65 | 'sell'] = 1 66 | 67 | return dataframe 68 | -------------------------------------------------------------------------------- /Ichimoku_v7.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v7(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 100 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [ 33 | ] 34 | 35 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 36 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 37 | # dataframe['chikou_span'] = ichi['chikou_span'] 38 | dataframe['tenkan'] = ichi['tenkan_sen'] 39 | dataframe['kijun'] = ichi['kijun_sen'] 40 | dataframe['senkou_a'] = ichi['senkou_span_a'] 41 | dataframe['senkou_b'] = ichi['senkou_span_b'] 42 | dataframe['cloud_green'] = ichi['cloud_green'] 43 | dataframe['cloud_red'] = ichi['cloud_red'] 44 | 45 | return dataframe 46 | 47 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 48 | dataframe.loc[ 49 | ( 50 | (dataframe['close'] > dataframe['senkou_a']) & 51 | (dataframe['close'] > dataframe['senkou_b']) 52 | ), 53 | 'buy'] = 1 54 | 55 | return dataframe 56 | 57 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 58 | dataframe.loc[ 59 | ( 60 | (dataframe['close'] < dataframe['senkou_a']) & 61 | (dataframe['close'] < dataframe['senkou_b']) 62 | #(dataframe['cloud_red'] == True) 63 | ), 64 | 'sell'] = 1 65 | 66 | return dataframe 67 | -------------------------------------------------------------------------------- /Ichimoku_v8.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v8(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 100 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [ 33 | ] 34 | 35 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 36 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 37 | # dataframe['chikou_span'] = ichi['chikou_span'] 38 | dataframe['tenkan'] = ichi['tenkan_sen'] 39 | dataframe['kijun'] = ichi['kijun_sen'] 40 | dataframe['senkou_a'] = ichi['senkou_span_a'] 41 | dataframe['senkou_b'] = ichi['senkou_span_b'] 42 | dataframe['cloud_green'] = ichi['cloud_green'] 43 | dataframe['cloud_red'] = ichi['cloud_red'] 44 | 45 | return dataframe 46 | 47 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 48 | dataframe.loc[ 49 | ( 50 | (qtpylib.crossed_above(dataframe['tenkan'], dataframe['kijun'])) & 51 | (dataframe['close'] > dataframe['senkou_a']) & 52 | (dataframe['close'] > dataframe['senkou_b']) 53 | ), 54 | 'buy'] = 1 55 | 56 | return dataframe 57 | 58 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 59 | dataframe.loc[ 60 | ( 61 | (qtpylib.crossed_above(dataframe['senkou_b'], dataframe['senkou_a'])) & 62 | (dataframe['close'] < dataframe['senkou_a']) & 63 | (dataframe['close'] < dataframe['senkou_b']) & 64 | (dataframe['cloud_red'] == True) 65 | ), 66 | 'sell'] = 1 67 | 68 | return dataframe 69 | -------------------------------------------------------------------------------- /Ichimoku_v9.py: -------------------------------------------------------------------------------- 1 | from freqtrade.strategy.interface import IStrategy 2 | from pandas import DataFrame 3 | #from technical.indicators import accumulation_distribution 4 | from technical.util import resample_to_interval, resampled_merge 5 | import talib.abstract as ta 6 | import freqtrade.vendor.qtpylib.indicators as qtpylib 7 | import numpy 8 | from technical.indicators import ichimoku 9 | 10 | class Ichimoku_v9(IStrategy): 11 | """ 12 | 13 | """ 14 | 15 | minimal_roi = { 16 | "0": 100 17 | } 18 | 19 | stoploss = -1 #-0.35 20 | 21 | ticker_interval = '4h' #3m 22 | 23 | # startup_candle_count: int = 2 24 | 25 | # trailing stoploss 26 | #trailing_stop = True 27 | #trailing_stop_positive = 0.40 #0.35 28 | #trailing_stop_positive_offset = 0.50 29 | #trailing_only_offset_is_reached = False 30 | 31 | def informative_pairs(self): 32 | return [] 33 | 34 | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 35 | ichi = ichimoku(dataframe, conversion_line_period=20, base_line_periods=60, laggin_span=120, displacement=30) 36 | # dataframe['chikou_span'] = ichi['chikou_span'] 37 | dataframe['tenkan'] = ichi['tenkan_sen'] 38 | dataframe['kijun'] = ichi['kijun_sen'] 39 | dataframe['senkou_a'] = ichi['senkou_span_a'] 40 | dataframe['senkou_b'] = ichi['senkou_span_b'] 41 | dataframe['cloud_green'] = ichi['cloud_green'] 42 | dataframe['cloud_red'] = ichi['cloud_red'] 43 | 44 | return dataframe 45 | 46 | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 47 | dataframe.loc[ 48 | ( 49 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_a'])) & 50 | (dataframe['close'] > dataframe['senkou_a']) & 51 | (dataframe['close'] > dataframe['senkou_b']) 52 | ), 53 | 'buy'] = 1 54 | 55 | dataframe.loc[ 56 | ( 57 | (qtpylib.crossed_above(dataframe['close'], dataframe['senkou_b'])) & 58 | (dataframe['close'] > dataframe['senkou_a']) & 59 | (dataframe['close'] > dataframe['senkou_b']) 60 | ), 61 | 'buy'] = 1 62 | 63 | return dataframe 64 | 65 | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: 66 | dataframe.loc[ 67 | ( 68 | (qtpylib.crossed_below(dataframe['tenkan'], dataframe['kijun'])) & 69 | (dataframe['close'] < dataframe['senkou_a']) & 70 | (dataframe['close'] < dataframe['senkou_b']) & 71 | (dataframe['cloud_red'] == True) 72 | ), 73 | 'sell'] = 1 74 | 75 | return dataframe 76 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # freq-strategies-Ichimoku 2 | Freqtrade Strategies (Ichimoku) 3 | 4 | # Test pairlist 5 | 6 | Can be used to generate static pairlists to be used during backtesting / hyperopt. 7 | 8 | ```bash 9 | freqtrade test-pairlist --config config.json 10 | ``` 11 | 12 | # Download Data 13 | 14 | ****05/08/2021 - USDT - 4 hours**** 15 | 16 | ```bash 17 | freqtrade download-data --config config_usdt.json --timeframes 4h --days 13 18 | ``` 19 | 20 | ****23/07/2021 - USDT - 1 day**** 21 | 22 | ```bash 23 | freqtrade download-data --config config_usdt.json --timeframes 1d --days 13 24 | ``` 25 | 26 | ****05/08/2021 - USDT - 1 week**** 27 | 28 | ```bash 29 | freqtrade download-data --config config_usdt.json --timeframes 1w --days 13 30 | ``` 31 | 32 | # Backtesting Strategy List 33 | 34 | ```bash 35 | freqtrade backtesting --strategy-list Ichimoku_v1 Ichimoku_v2 Ichimoku_v3 Ichimoku_v4 Ichimoku_v5 Ichimoku_v6 Ichimoku_v7 Ichimoku_v8 Ichimoku_v9 Ichimoku_v10 Ichimoku_v11 Ichimoku_v12 Ichimoku_v13 Ichimoku_v14 Ichimoku_v16 Ichimoku_v17 Ichimoku_v18 Ichimoku_v19 Ichimoku_v20 Ichimoku_v21 Ichimoku_v22 Ichimoku_v23 Ichimoku_v24 Ichimoku_v25 Ichimoku_v26 Ichimoku_v27 Ichimoku_v28 Ichimoku_v29 Ichimoku_v30 Ichimoku_v31 Ichimoku_v32 Ichimoku_v33 Ichimoku_v34 --config config_usdt.json --timeframe 4h --timerange=20181201- 36 | ``` 37 | 38 | ![](backtesting_3.png) 39 | 40 | # Backtesting Ichimoku_v24 41 | 42 | ![](Ichimoku_v24.png) 43 | 44 | # Backtesting Ichimoku_v25 45 | 46 | ![](Ichimoku_v25.png) 47 | 48 | 49 | 50 | 51 | # Update Freqtrade 52 | 53 | ```bash 54 | ./setup.sh -u 55 | ``` 56 | 57 | ```bash 58 | git checkout develop 59 | ``` 60 | 61 | ```bash 62 | git stash 63 | ``` 64 | 65 | ```bash 66 | git pull 67 | ``` 68 | 69 | warning: Pulling without specifying how to reconcile divergent branches is 70 | discouraged. You can squelch this message by running one of the following 71 | commands sometime before your next pull: 72 | 73 | git config pull.rebase false # merge (the default strategy) 74 | git config pull.rebase true # rebase 75 | git config pull.ff only # fast-forward only 76 | 77 | You can replace "git config" with "git config --global" to set a default 78 | preference for all repositories. You can also pass --rebase, --no-rebase, 79 | or --ff-only on the command line to override the configured default per 80 | invocation. 81 | 82 | Updating 5f483acd..729e7733 83 | error: Your local changes to the following files would be overwritten by merge: 84 | freqtrade/main.py 85 | Please commit your changes or stash them before you merge. 86 | Aborting 87 | 88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /backtesting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tutecode/freq-strategies/d68211c0d1f6c8265af50f9b03d2a98310f24a55/backtesting.png -------------------------------------------------------------------------------- /backtesting_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tutecode/freq-strategies/d68211c0d1f6c8265af50f9b03d2a98310f24a55/backtesting_2.png -------------------------------------------------------------------------------- /backtesting_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tutecode/freq-strategies/d68211c0d1f6c8265af50f9b03d2a98310f24a55/backtesting_3.png -------------------------------------------------------------------------------- /config_usdt.json: -------------------------------------------------------------------------------- 1 | { 2 | "max_open_trades": 100, 3 | "stake_currency": "USDT", 4 | "stake_amount": "unlimited", 5 | "tradable_balance_ratio": 0.99, 6 | "fiat_display_currency": "USD", 7 | "timeframe": "4h", 8 | "dry_run": true, 9 | "dry_run_wallet": 2000, 10 | "cancel_open_orders_on_exit": false, 11 | "trailing_stop": true, 12 | "unfilledtimeout": { 13 | "buy": 10, 14 | "sell": 30 15 | }, 16 | "bid_strategy": { 17 | "price_side": "ask", 18 | "ask_last_balance": 0.0, 19 | "use_order_book": false, 20 | "order_book_top": 1, 21 | "check_depth_of_market": { 22 | "enabled": false, 23 | "bids_to_ask_delta": 1 24 | } 25 | }, 26 | "ask_strategy":{ 27 | "price_side": "bid", 28 | "use_order_book": false, 29 | "order_book_min": 1, 30 | "order_book_max": 1, 31 | "use_sell_signal": true, 32 | "sell_profit_only": false, 33 | "ignore_roi_if_buy_signal": false 34 | }, 35 | "order_types": { 36 | "buy": "market", 37 | "sell": "market", 38 | "emergencysell": "market", 39 | "forcesell": "market", 40 | "forcebuy": "market", 41 | "stoploss": "market", 42 | "stoploss_on_exchange": false, 43 | "stoploss_on_exchange_interval": 60 44 | }, 45 | "order_time_in_force": { 46 | "buy": "gtc", 47 | "sell": "gtc" 48 | }, 49 | "exchange": { 50 | "name": "binance", 51 | "key": "", 52 | "secret": "", 53 | "ccxt_config": {"enableRateLimit": true}, 54 | "ccxt_async_config": { 55 | "enableRateLimit": true, 56 | "rateLimit": 500 57 | }, 58 | "pair_whitelist": [ 59 | "BTC/USDT", 60 | "ETH/USDT", 61 | "LTC/USDT", 62 | "BCH/USDT", 63 | "XRP/USDT", 64 | "BNB/USDT", 65 | "NEO/USDT", 66 | "QTUM/USDT", 67 | "ADA/USDT", 68 | "EOS/USDT", 69 | "IOTA/USDT", 70 | "ETC/USDT", 71 | "TRX/USDT", 72 | "ONT/USDT", 73 | "LINK/USDT", 74 | "FET/USDT", 75 | "BAT/USDT", 76 | "XMR/USDT", 77 | "ATOM/USDT", 78 | "OMG/USDT", 79 | "VET/USDT", 80 | "DASH/USDT", 81 | "ZEC/USDT", 82 | "ZRX/USDT", 83 | "SNX/USDT", 84 | "COMP/USDT", 85 | "ALGO/USDT", 86 | "REN/USDT", 87 | "THETA/USDT", 88 | "WAVES/USDT", 89 | "ICX/USDT", 90 | "KNC/USDT", 91 | "HBAR/USDT", 92 | "LSK/USDT", 93 | "REP/USDT", 94 | "ZIL/USDT", 95 | "BAND/USDT", 96 | "SXP/USDT", 97 | "YFI/USDT", 98 | "DOT/USDT", 99 | "KAVA/USDT", 100 | "YFII/USDT", 101 | "PAXG/USDT", 102 | "MKR/USDT", 103 | "KSM/USDT", 104 | "WNXM/USDT", 105 | "TRB/USDT", 106 | "NMR/USDT", 107 | "BAL/USDT", 108 | "DCR/USDT", 109 | "UMA/USDT", 110 | "EGLD/USDT", 111 | "UNI/USDT", 112 | "XZC/USDT", 113 | "ANT/USDT", 114 | "FTT/USDT", 115 | "SOL/USDT", 116 | "DIA/USDT", 117 | "TFUEL/USDT", 118 | "RUNE/USDT", 119 | "WING/USDT", 120 | "AAVE/USDT", 121 | "AION/USDT", 122 | "AKRO/USDT", 123 | "ALPHA/USDT", 124 | "ANKR/USDT", 125 | "ARDR/USDT", 126 | "ARPA/USDT", 127 | "AUDIO/USDT", 128 | "AUD/USDT", 129 | "AVA/USDT", 130 | "AVAX/USDT", 131 | "AXS/USDT", 132 | "BEAM/USDT", 133 | "BEL/USDT", 134 | "BLZ/USDT", 135 | "BNT/USDT", 136 | "BTS/USDT", 137 | "BTT/USDT", 138 | "BZRX/USDT", 139 | "CELR/USDT", 140 | "CHR/USDT", 141 | "COS/USDT", 142 | "COTI/USDT", 143 | "CRV/USDT", 144 | "CTK/USDT", 145 | "CTSI/USDT", 146 | "CTXC/USDT", 147 | "CVC/USDT", 148 | "DATA/USDT", 149 | "DENT/USDT", 150 | "DGB/USDT", 151 | "DNT/USDT", 152 | "DOCK/USDT", 153 | "DOGE/USDT", 154 | "DREP/USDT", 155 | "DUSK/USDT", 156 | "ENJ/USDT", 157 | "FIL/USDT", 158 | "FIO/USDT", 159 | "FLM/USDT", 160 | "FTM/USDT", 161 | "FUN/USDT", 162 | "GBP/USDT", 163 | "GTO/USDT", 164 | "GXS/USDT", 165 | "HARD/USDT", 166 | "HIVE/USDT", 167 | "HNT/USDT", 168 | "HOT/USDT", 169 | "INJ/USDT", 170 | "IOST/USDT", 171 | "IOTX/USDT", 172 | "IRIS/USDT", 173 | "JST/USDT", 174 | "KEY/USDT", 175 | "KMD/USDT", 176 | "LRC/USDT", 177 | "LTO/USDT", 178 | "LUNA/USDT", 179 | "MATIC/USDT", 180 | "MBL/USDT", 181 | "NPXS/USDT", 182 | "NULS/USDT", 183 | "OCEAN/USDT", 184 | "OGN/USDT", 185 | "ONG/USDT", 186 | "ORN/USDT", 187 | "OXT/USDT", 188 | "PAX/USDT", 189 | "PERL/USDT", 190 | "PNT/USDT", 191 | "RLC/USDT", 192 | "ROSE/USDT", 193 | "RSR/USDT", 194 | "RVN/USDT", 195 | "SAND/USDT", 196 | "SC/USDT", 197 | "SRM/USDT", 198 | "STMX/USDT", 199 | "STORJ/USDT", 200 | "STPT/USDT", 201 | "STRAX/USDT", 202 | "STX/USDT", 203 | "SUN/USDT", 204 | "SUSHI/USDT", 205 | "TCT/USDT", 206 | "TOMO/USDT", 207 | "TROY/USDT", 208 | "UNFI/USDT", 209 | "UTK/USDT", 210 | "VITE/USDT", 211 | "VTHO/USDT", 212 | "WAN/USDT", 213 | "WRX/USDT", 214 | "WTC/USDT", 215 | "XEM/USDT", 216 | "XVS/USDT", 217 | "CAKE/USDT", 218 | "DODO/USDT", 219 | "ACM/USDT", 220 | "BADGER/USDT", 221 | "FIS/USDT", 222 | "OM/USDT", 223 | "POND/USDT", 224 | "ATM/USDT", 225 | "SKL/USDT", 226 | "GRT/USDT", 227 | "JUV/USDT", 228 | "PSG/USDT", 229 | "1INCH/USDT", 230 | "REEF/USDT", 231 | "OG/USDT", 232 | "ASR/USDT", 233 | "CELO/USDT", 234 | "RIF/USDT", 235 | "BTCST/USDT", 236 | "TRU/USDT", 237 | "CKB/USDT", 238 | "TWT/USDT", 239 | "FIRO/USDT", 240 | "LIT/USDT", 241 | "SFP/USDT", 242 | "COCOS/USDT", 243 | "ONE/USDT", 244 | "BAKE/USDT", 245 | "EPS/USDT", 246 | "MASK/USDT", 247 | "TKO/USDT", 248 | "MDX/USDT", 249 | "SUPER/USDT", 250 | "ICP/USDT" 251 | ], 252 | "pair_blacklist": [ 253 | "PAXG/USDT", 254 | "DAI/USDT", 255 | "PAX/USDT", 256 | "AUD/USDT", 257 | "AUG/USDT", 258 | "GBP/USDT", 259 | "USDC/USDT", 260 | "BUSD/USDT", 261 | "EUR/USDT", 262 | ".*USD/USDT", 263 | ".*DOWN/USDT", 264 | ".*UP/USDT", 265 | ".*BEAR/USDT", 266 | ".*BULL/USDT" 267 | ] 268 | }, 269 | "pairlists": [ 270 | {"method": "StaticPairList"}, 271 | {"method": "AgeFilter", "min_days_listed": 30} 272 | ], 273 | "edge": { 274 | "enabled": false, 275 | "process_throttle_secs": 3600, 276 | "calculate_since_number_of_days": 7, 277 | "allowed_risk": 0.01, 278 | "stoploss_range_min": -0.01, 279 | "stoploss_range_max": -0.1, 280 | "stoploss_range_step": -0.01, 281 | "minimum_winrate": 0.60, 282 | "minimum_expectancy": 0.20, 283 | "min_trade_number": 10, 284 | "max_trade_duration_minute": 1440, 285 | "remove_pumps": false 286 | }, 287 | "telegram": { 288 | "enabled": true, 289 | "token": "", 290 | "chat_id": "" 291 | }, 292 | "api_server": { 293 | "enabled": false, 294 | "listen_ip_address": "127.0.0.1", 295 | "listen_port": 8080, 296 | "verbosity": "info", 297 | "jwt_secret_key": "somethingrandom", 298 | "CORS_origins": [], 299 | "username": "", 300 | "password": "" 301 | }, 302 | "initial_state": "running", 303 | "forcebuy_enable": true, 304 | "internals": { 305 | "process_throttle_secs": 5 306 | } 307 | } 308 | --------------------------------------------------------------------------------