From a2d714b473000712ca648f333de67b23e83a4cc5 Mon Sep 17 00:00:00 2001 From: Maxime Puys Date: Tue, 10 Aug 2021 13:27:37 +0200 Subject: [PATCH 1/2] Updated: hyperoptable parameters for CofiBitStrategy --- .../berlinguyinca/CofiBitStrategy.py | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/user_data/strategies/berlinguyinca/CofiBitStrategy.py b/user_data/strategies/berlinguyinca/CofiBitStrategy.py index 4058139..b81910d 100644 --- a/user_data/strategies/berlinguyinca/CofiBitStrategy.py +++ b/user_data/strategies/berlinguyinca/CofiBitStrategy.py @@ -2,6 +2,7 @@ import freqtrade.vendor.qtpylib.indicators as qtpylib import talib.abstract as ta from freqtrade.strategy.interface import IStrategy +from freqtrade.strategy import IntParameter from pandas import DataFrame @@ -12,6 +13,16 @@ class CofiBitStrategy(IStrategy): """ taken from slack by user CofiBit """ + + # Buy hyperspace params: + buy_params = { + "buy_lim": 25, + } + + # Sell hyperspace params: + sell_params = { + "sell_lim": 75, + } # Minimal ROI designed for the strategy. # This attribute will be overridden if the config file contains "minimal_roi" @@ -29,6 +40,9 @@ class CofiBitStrategy(IStrategy): # Optimal timeframe for the strategy timeframe = '5m' + buy_lim = IntParameter(20, 30, default=25) + sell_lim = IntParameter(70, 80, default=75) + def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: stoch_fast = ta.STOCHF(dataframe, 5, 3, 0, 3, 0) dataframe['fastd'] = stoch_fast['fastd'] @@ -51,9 +65,9 @@ class CofiBitStrategy(IStrategy): (dataframe['open'] < dataframe['ema_low']) & (qtpylib.crossed_above(dataframe['fastk'], dataframe['fastd'])) & # (dataframe['fastk'] > dataframe['fastd']) & - (dataframe['fastk'] < 30) & - (dataframe['fastd'] < 30) & - (dataframe['adx'] > 30) + (dataframe['fastk'] < self.buy_lim.value) & + (dataframe['fastd'] < self.buy_lim.value) & + (dataframe['adx'] > self.buy_lim.value) ), 'buy'] = 1 @@ -70,10 +84,10 @@ class CofiBitStrategy(IStrategy): (dataframe['open'] >= dataframe['ema_high']) ) | ( - # (dataframe['fastk'] > 70) & - # (dataframe['fastd'] > 70) - (qtpylib.crossed_above(dataframe['fastk'], 70)) | - (qtpylib.crossed_above(dataframe['fastd'], 70)) + # (dataframe['fastk'] > self.sell_lim.value) & + # (dataframe['fastd'] > self.sell_lim.value) + (qtpylib.crossed_above(dataframe['fastk'], self.sell_lim.value)) | + (qtpylib.crossed_above(dataframe['fastd'], self.sell_lim.value)) ), 'sell'] = 1 From 459f82828fc6671dfb8acf45f06ed922b6f160b2 Mon Sep 17 00:00:00 2001 From: Maxime Puys Date: Wed, 11 Aug 2021 18:55:53 +0200 Subject: [PATCH 2/2] Updated: hyperoptable parameters for CofiBitStrategy with ADX separated --- .../berlinguyinca/CofiBitStrategy.py | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/user_data/strategies/berlinguyinca/CofiBitStrategy.py b/user_data/strategies/berlinguyinca/CofiBitStrategy.py index b81910d..8f86059 100644 --- a/user_data/strategies/berlinguyinca/CofiBitStrategy.py +++ b/user_data/strategies/berlinguyinca/CofiBitStrategy.py @@ -16,12 +16,13 @@ class CofiBitStrategy(IStrategy): # Buy hyperspace params: buy_params = { - "buy_lim": 25, + "buy_fastx": 25, + "buy_adx": 25, } # Sell hyperspace params: sell_params = { - "sell_lim": 75, + "sell_fastx": 75, } # Minimal ROI designed for the strategy. @@ -40,8 +41,9 @@ class CofiBitStrategy(IStrategy): # Optimal timeframe for the strategy timeframe = '5m' - buy_lim = IntParameter(20, 30, default=25) - sell_lim = IntParameter(70, 80, default=75) + buy_fastx = IntParameter(20, 30, default=25) + buy_adx = IntParameter(20, 30, default=25) + sell_fastx = IntParameter(70, 80, default=75) def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: stoch_fast = ta.STOCHF(dataframe, 5, 3, 0, 3, 0) @@ -64,10 +66,9 @@ class CofiBitStrategy(IStrategy): ( (dataframe['open'] < dataframe['ema_low']) & (qtpylib.crossed_above(dataframe['fastk'], dataframe['fastd'])) & - # (dataframe['fastk'] > dataframe['fastd']) & - (dataframe['fastk'] < self.buy_lim.value) & - (dataframe['fastd'] < self.buy_lim.value) & - (dataframe['adx'] > self.buy_lim.value) + (dataframe['fastk'] < self.buy_fastx.value) & + (dataframe['fastd'] < self.buy_fastx.value) & + (dataframe['adx'] > self.buy_adx.value) ), 'buy'] = 1 @@ -84,10 +85,8 @@ class CofiBitStrategy(IStrategy): (dataframe['open'] >= dataframe['ema_high']) ) | ( - # (dataframe['fastk'] > self.sell_lim.value) & - # (dataframe['fastd'] > self.sell_lim.value) - (qtpylib.crossed_above(dataframe['fastk'], self.sell_lim.value)) | - (qtpylib.crossed_above(dataframe['fastd'], self.sell_lim.value)) + (qtpylib.crossed_above(dataframe['fastk'], self.sell_fastx.value)) | + (qtpylib.crossed_above(dataframe['fastd'], self.sell_fastx.value)) ), 'sell'] = 1