From 6757f4d432efb27b2e3815c6b774d330abe8d6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Delacotte?= Date: Sat, 1 Nov 2025 22:50:56 +0100 Subject: [PATCH] Zeus_8_3_2_B_4_2 Test slope_inf et sup --- Zeus_8_3_2_B_4_2.json | 34 +++++++++++--------- Zeus_8_3_2_B_4_2.py | 73 +++++++++++++++++++++++++++++++------------ 2 files changed, 73 insertions(+), 34 deletions(-) diff --git a/Zeus_8_3_2_B_4_2.json b/Zeus_8_3_2_B_4_2.json index e6cb8fb..c98d04b 100644 --- a/Zeus_8_3_2_B_4_2.json +++ b/Zeus_8_3_2_B_4_2.json @@ -4,6 +4,9 @@ "roi": { "0": 10 }, + "stoploss": { + "stoploss": -1.0 + }, "trailing": { "trailing_stop": true, "trailing_stop_positive": 0.15, @@ -14,24 +17,27 @@ "max_open_trades": 80 }, "buy": { - "indic_deriv_5m_buy": "sma12", + "indic_deriv_5m_slop_sup_buy": "sma12", + "indic_deriv_5m_slop_sup_inf": "sma12", + "mises": 10, + "pct": 0.012, "pct_inc": 0.0022, - "deriv_5m_buy": 0.04, - "indic_5m": "sma24", - "mise_factor_buy": 0.01, - "mises": 2, - "pct": 0.007 + "deriv_5m_slope_sup_buy": -0.02, + "deriv_5m_slope_sup_inf": 0.27, + "indic_5m_slope_inf": "sma12", + "indic_5m_slope_sup": "sma60", + "mise_factor_buy": 0.01 }, "sell": { - "deriv_5m_sell": 0.36, - "indic_5m_sell": "sma24", - "indic_deriv_5m_sell": "sma24" + "deriv_5m_slope_inf_sell": -0.08, + "deriv_5m_slope_sup_sell": 0.14, + "indic_5m_slope_inf_sell": "sma24", + "indic_5m_slope_sup_sell": "sma24", + "indic_deriv_5m_slope_inf_sell": "sma5", + "indic_deriv_5m_slope_sup_sell": "sma60" }, - "protection": {}, - "stoploss": { - "stoploss": -0.134 - } + "protection": {} }, "ft_stratparam_v": 1, - "export_time": "2025-11-01 17:30:18.037599+00:00" + "export_time": "2025-11-01 21:44:32.435062+00:00" } \ No newline at end of file diff --git a/Zeus_8_3_2_B_4_2.py b/Zeus_8_3_2_B_4_2.py index c86c804..5bae06a 100644 --- a/Zeus_8_3_2_B_4_2.py +++ b/Zeus_8_3_2_B_4_2.py @@ -258,14 +258,20 @@ class Zeus_8_3_2_B_4_2(IStrategy): indicators = {'sma5', 'sma12', 'sma24', 'sma60'} indicators_percent = {'percent', 'percent3', 'percent12', 'percent24', 'percent_1h', 'percent3_1h', 'percent12_1h', 'percent24_1h'} - mises = IntParameter(1, 50, default=10, space='buy', optimize=True, load=True) + mises = IntParameter(1, 50, default=10, space='buy', optimize=False, load=False) + + pct = DecimalParameter(0.005, 0.05, default=0.012, decimals=3, space='buy', optimize=False, load=False) + pct_inc = DecimalParameter(0.0001, 0.003, default=0.0022, decimals=4, space='buy', optimize=False, load=False) + + indic_5m_slope_sup = CategoricalParameter(indicators, default="sma60", space='buy') + indic_deriv_5m_slop_sup_buy = CategoricalParameter(indicators, default="sma12", space='buy', optimize=False, load=False) + deriv_5m_slope_sup_buy = DecimalParameter(-0.1, 0.5, default=0, decimals=2, space='buy', optimize=True, load=True) + + indic_5m_slope_inf = CategoricalParameter(indicators, default="sma60", space='buy') + indic_deriv_5m_slop_sup_inf = CategoricalParameter(indicators, default="sma12", space='buy', optimize=False, load=False) + deriv_5m_slope_sup_inf = DecimalParameter(-0.1, 0.5, default=0, decimals=2, space='buy', optimize=True, load=True) - pct = DecimalParameter(0.005, 0.05, default=0.012, decimals=3, space='buy', optimize=True, load=True) - pct_inc = DecimalParameter(0.0001, 0.003, default=0.0022, decimals=4, space='buy', optimize=False, load=True) - indic_5m = CategoricalParameter(indicators, default="sma60", space='buy') - indic_deriv_5m_buy = CategoricalParameter(indicators, default="sma12", space='buy', optimize=False, load=False) - deriv_5m_buy = DecimalParameter(-0.1, 0.5, default=0, decimals=2, space='buy', optimize=True, load=True) # indic_deriv1_5m = DecimalParameter(-2, 2, default=0, decimals=2, space='buy', optimize=True, load=True) # indic_deriv2_5m = DecimalParameter(-2, 2, default=0, decimals=2, space='buy', optimize=True, load=True) @@ -280,9 +286,14 @@ class Zeus_8_3_2_B_4_2(IStrategy): # indic_deriv2_1d_p_start = DecimalParameter(-4, 4, default=0, decimals=1, space='protection', optimize=True, load=True) - indic_5m_sell = CategoricalParameter(indicators, default="sma60", space='sell') - indic_deriv_5m_sell = CategoricalParameter(indicators, default="sma60", space='sell') - deriv_5m_sell = DecimalParameter(-0.1, 0.5, default=0, decimals=2, space='sell', optimize=True, load=True) + indic_5m_slope_sup_sell = CategoricalParameter(indicators, default="sma60", space='sell') + indic_deriv_5m_slope_sup_sell = CategoricalParameter(indicators, default="sma60", space='sell') + deriv_5m_slope_sup_sell = DecimalParameter(-0.1, 0.5, default=0, decimals=2, space='sell', optimize=True, load=True) + + indic_5m_slope_inf_sell = CategoricalParameter(indicators, default="sma60", space='sell') + indic_deriv_5m_slope_inf_sell = CategoricalParameter(indicators, default="sma60", space='sell') + deriv_5m_slope_inf_sell = DecimalParameter(-0.1, 0.5, default=0, decimals=2, space='sell', optimize=True, load=True) + # indic_percent_sell = CategoricalParameter(indicators_percent, default="sma60", space='sell') # percent_5m_sell = DecimalParameter(-0.1, -0.0, default=0, decimals=2, space='sell', optimize=True, load=True) @@ -1337,12 +1348,23 @@ class Zeus_8_3_2_B_4_2(IStrategy): dataframe.loc[ ( - (dataframe[f"{self.indic_5m.value}"].shift(2) >= dataframe[f"{self.indic_5m.value}"].shift(1)) - & (dataframe[f"{self.indic_5m.value}"].shift(1) <= dataframe[f"{self.indic_5m.value}"]) - & (dataframe[f"{self.indic_deriv_5m_buy.value}_deriv1"] > self.deriv_5m_buy.value) + (dataframe[f"{self.indic_5m_slope_sup.value}"].shift(2) >= dataframe[f"{self.indic_5m_slope_sup.value}"].shift(1)) + & (dataframe[f"{self.indic_5m_slope_sup.value}"].shift(1) <= dataframe[f"{self.indic_5m_slope_sup.value}"]) + & (dataframe['slope_norm_1d'] < dataframe['slope_norm_1h']) + # & (dataframe[f"{self.indic_deriv_5m_buy.value}_deriv1"] > self.deriv_5m_buy.value) # & (dataframe[f"sma60_deriv1"] >= -0.2) # & (dataframe[f"hapercent"] >= -0.001) - ), ['enter_long', 'enter_tag']] = (1, f"{self.indic_5m.value}") + ), ['enter_long', 'enter_tag']] = (1, f"{self.indic_5m_slope_sup.value}_sup") + + dataframe.loc[ + ( + (dataframe[f"{self.indic_5m_slope_inf.value}"].shift(2) >= dataframe[f"{self.indic_5m_slope_inf.value}"].shift(1)) + & (dataframe[f"{self.indic_5m_slope_inf.value}"].shift(1) <= dataframe[f"{self.indic_5m_slope_inf.value}"]) + & (dataframe['slope_norm_1d'] > dataframe['slope_norm_1h']) + # & (dataframe[f"{self.indic_deriv_5m_buy.value}_deriv1"] > self.deriv_5m_buy.value) + # & (dataframe[f"sma60_deriv1"] >= -0.2) + # & (dataframe[f"hapercent"] >= -0.001) + ), ['enter_long', 'enter_tag']] = (1, f"{self.indic_5m_slope_inf.value}_inf") dataframe['test'] = np.where(dataframe['enter_long'] == 1, dataframe['close'] * 1.01, np.nan) @@ -1504,10 +1526,19 @@ class Zeus_8_3_2_B_4_2(IStrategy): # {indic_5m_sell} {indic_deriv1_5m_sell} {indic_deriv2_5m_sell} dataframe.loc[ ( - (dataframe[f"{self.indic_5m_sell.value}"].shift(2) < dataframe[f"{self.indic_5m_sell.value}"].shift(1)) - & (dataframe[f"{self.indic_5m_sell.value}"].shift(1) > dataframe[f"{self.indic_5m_sell.value}"]) - & (dataframe[f"{self.indic_deriv_5m_sell.value}_deriv1"] < self.deriv_5m_sell.value) - ), ['exit_long', 'exit_tag']] = (1, f"{self.indic_5m_sell.value}") + (dataframe[f"{self.indic_5m_slope_sup_sell.value}"].shift(2) < dataframe[f"{self.indic_5m_slope_sup_sell.value}"].shift(1)) + & (dataframe[f"{self.indic_5m_slope_sup_sell.value}"].shift(1) > dataframe[f"{self.indic_5m_slope_sup_sell.value}"]) + & (dataframe[f"{self.indic_deriv_5m_slope_sup_sell.value}_deriv1"] < self.deriv_5m_slope_sup_sell.value) + & (dataframe['slope_norm_1d'] > dataframe['slope_norm_1h']) + ), ['exit_long', 'exit_tag']] = (1, f"{self.indic_5m_slope_sup_sell.value}_sup") + + dataframe.loc[ + ( + (dataframe[f"{self.indic_5m_slope_inf_sell.value}"].shift(2) < dataframe[f"{self.indic_5m_slope_inf_sell.value}"].shift(1)) + & (dataframe[f"{self.indic_5m_slope_inf_sell.value}"].shift(1) > dataframe[f"{self.indic_5m_slope_inf_sell.value}"]) + & (dataframe[f"{self.indic_deriv_5m_slope_inf_sell.value}_deriv1"] < self.deriv_5m_slope_inf_sell.value) + & (dataframe['slope_norm_1d'] < dataframe['slope_norm_1h']) + ), ['exit_long', 'exit_tag']] = (1, f"{self.indic_5m_slope_inf_sell.value}_inf") # dataframe.loc[ # ( @@ -1757,8 +1788,8 @@ class Zeus_8_3_2_B_4_2(IStrategy): # dist_max = self.getDistMax(last_candle, pair) # factor = self.multi_step_interpolate(dist_max, self.thresholds, self.factors) factor = 1 #65 / min(65, last_candle['rsi_1d']) - # if last_candle['sma60_deriv1'] > 0 and last_candle['sma24_deriv1_1h'] > 0: - # factor = 1.5 + if last_candle['slope_norm_1d'] < last_candle['slope_norm_1h']: + factor = 2 adjusted_stake_amount = max(base_stake_amount / 5, base_stake_amount * factor) else: @@ -2351,6 +2382,8 @@ class Zeus_8_3_2_B_4_2(IStrategy): def should_enter_trade(self, pair: str, last_candle, current_time) -> bool: limit = 3 + # return last_candle['slope_norm_1d'] < last_candle['slope_norm_1h'] + if self.pairs[pair]['stop'] and last_candle['max_rsi_12_1h'] <= 60 and last_candle['trend_class_1h'] == 'BR1': dispo = round(self.wallets.get_available_stake_amount()) self.pairs[pair]['stop'] = False @@ -2552,7 +2585,7 @@ class Zeus_8_3_2_B_4_2(IStrategy): # df["slope_smooth"] = savgol_filter(df["slope_smooth"], window_length=21, polyorder=3) # --- normalisation relative --- - df['slope_norm'] = df['slope_smooth'] / df['close'] + df['slope_norm'] = 10000 * df['slope_smooth'] / df['close'] # df['slope_norm'].fillna(0, inplace=True) df['slope_norm'] = df['slope_norm'].fillna(0)