From d9f947481e2c367584fd810556f43251484979ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Delacotte?= Date: Thu, 6 Nov 2025 15:02:48 +0100 Subject: [PATCH] hyperopt ETH --- Zeus_8_3_2_B_4_2.json | 34 +++++++++++------------ Zeus_8_3_2_B_4_2.py | 64 +++++++++++++++++++++++++------------------ 2 files changed, 55 insertions(+), 43 deletions(-) diff --git a/Zeus_8_3_2_B_4_2.json b/Zeus_8_3_2_B_4_2.json index bf650cd..bb5fd35 100644 --- a/Zeus_8_3_2_B_4_2.json +++ b/Zeus_8_3_2_B_4_2.json @@ -12,35 +12,35 @@ }, "buy": { "mises": 5, - "deriv_5m_slope_sup_buy": 0.0, - "indic_5m_slope_inf_buy": "sma24", - "indic_5m_slope_sup_buy": "sma5", + "deriv_5m_slope_sup_buy": 0.14, + "indic_5m_slope_inf_buy": "sma12", + "indic_5m_slope_sup_buy": "sma12", "indic_deriv_5m_slop_sup_buy": "sma5", "mise_factor_buy": 0.01, - "pct": 0.016, - "pct_inc": 0.002 + "pct": 0.029, + "pct_inc": 0.0027 }, "sell": { - "deriv_5m_slope_inf_sell": -0.04, - "deriv_5m_slope_sup_sell": -0.05, - "indic_5m_slope_inf_sell": "sma24", - "indic_5m_slope_sup_sell": "sma24", - "indic_deriv_5m_slope_inf_sell": "sma60", + "deriv_5m_slope_inf_sell": 0.45, + "deriv_5m_slope_sup_sell": -0.07, + "indic_5m_slope_inf_sell": "sma60", + "indic_5m_slope_sup_sell": "sma12", + "indic_deriv_5m_slope_inf_sell": "sma5", "indic_deriv_5m_slope_sup_sell": "sma24" }, "protection": { - "deriv1_buy_protect": 0.09, + "deriv1_buy_protect": 0.06, "indic_1h_slope_sup": "sma5", - "indic_5m_slope_sup": "sma12", - "rsi_buy_protect": 51 + "indic_5m_slope_sup": "sma24", + "rsi_buy_protect": 53 }, "trailing": { "trailing_stop": true, - "trailing_stop_positive": 0.27, - "trailing_stop_positive_offset": 0.299, - "trailing_only_offset_is_reached": true + "trailing_stop_positive": 0.148, + "trailing_stop_positive_offset": 0.218, + "trailing_only_offset_is_reached": false } }, "ft_stratparam_v": 1, - "export_time": "2025-11-05 02:31:05.384528+00:00" + "export_time": "2025-11-06 13:54:42.462181+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 8578ddc..40f2643 100644 --- a/Zeus_8_3_2_B_4_2.py +++ b/Zeus_8_3_2_B_4_2.py @@ -59,7 +59,7 @@ def normalize(df): class Zeus_8_3_2_B_4_2(IStrategy): levels = [1, 2, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20] - startup_candle_count = 12 * 24 * 5 + # startup_candle_count = 12 * 24 * 5 # ROI table: minimal_roi = { @@ -361,12 +361,12 @@ class Zeus_8_3_2_B_4_2(IStrategy): last_candle_3 = dataframe.iloc[-3].squeeze() # val = self.getProbaHausse144(last_candle) - trend = last_candle['trend_class'] + # trend = last_candle['trend_class'] # params = self.loadParamsFor(pair, trend) - indic_5m = self.getParamValue(pair, trend, 'buy', 'indic_5m') - indic_deriv1_5m = self.getParamValue( pair, trend, 'buy', 'indic_deriv1_5m') - indic_deriv2_5m = self.getParamValue( pair, trend, 'buy', 'indic_deriv2_5m') + # indic_5m = self.getParamValue(pair, trend, 'buy', 'indic_5m') + # indic_deriv1_5m = self.getParamValue( pair, trend, 'buy', 'indic_deriv1_5m') + # indic_deriv2_5m = self.getParamValue( pair, trend, 'buy', 'indic_deriv2_5m') condition = True #(last_candle[f"{indic_5m}_deriv1"] >= indic_deriv1_5m) and (last_candle[f"{indic_5m}_deriv2"] >= indic_deriv2_5m) @@ -519,11 +519,11 @@ class Zeus_8_3_2_B_4_2(IStrategy): days_since_first_buy = (current_time - trade.open_date_utc).days hours = (current_time - trade.date_last_filled_utc).total_seconds() / 3600.0 - trend = last_candle['trend_class'] - - indic_5m_sell = self.getParamValue( pair, trend, 'sell', 'indic_5m_sell') - indic_deriv1_5m_sell = self.getParamValue( pair, trend, 'sell', 'indic_deriv1_5m_sell') - indic_deriv2_5m_sell = self.getParamValue( pair, trend, 'sell', 'indic_deriv2_5m_sell') + # trend = last_candle['trend_class'] + # + # indic_5m_sell = self.getParamValue( pair, trend, 'sell', 'indic_5m_sell') + # indic_deriv1_5m_sell = self.getParamValue( pair, trend, 'sell', 'indic_deriv1_5m_sell') + # indic_deriv2_5m_sell = self.getParamValue( pair, trend, 'sell', 'indic_deriv2_5m_sell') if hours % 4 == 0: self.log_trade( @@ -681,8 +681,9 @@ class Zeus_8_3_2_B_4_2(IStrategy): return if self.columns_logged % 10 == 0: self.printLog( - f"| {'Date':<16} | {'Action':<10} |{'Pair':<5}| {'Trade Type':<18} |{'Rate':>8} | {'Dispo':>6} | {'Profit':>8} | {'Pct':>6} | {'max_touch':>11} | {'last_lost':>12} | {'last_max':>7}| {'last_max':>7}|{'Buys':>5}| {'Stake':>5} |" - f"{'rsi':>6}|Distmax|s201d|s5_1d|s5_2d|s51h|s52h|smt1h|smt2h|" + f"| {'Date':<16} | {'Action':<10} |{'Pair':<5}| {'Trade Type':<18} |{'Rate':>8} | {'Dispo':>6} | {'Profit':>8} " + f"| {'Pct':>6} | {'max_touch':>11} | {'last_lost':>12} | {'last_max':>7}| {'last_max':>7}|{'Buys':>5}| {'Stake':>5} |" + f"{'rsi':>6}|Distmax|s201d|s5_1d|s5_2d|s51h|s52h|smt1h|smt2h|tdc1d|tdc1h" ) self.printLineLog() df = pd.DataFrame.from_dict(self.pairs, orient='index') @@ -765,15 +766,15 @@ class Zeus_8_3_2_B_4_2(IStrategy): # 🟡 Dérivée 1 > 0 et dérivée 2 < 0: tendance haussière qui ralentit → essoufflement potentiel. # 🔴 Dérivée 1 < 0 et dérivée 2 < 0: tendance baissière qui s’accélère. # 🟠 Dérivée 1 < 0 et dérivée 2 > 0: tendance baissière qui ralentit → possible bottom. - trend = last_candle['trend_class_1d'] - - indic_5m = self.getParamValue(pair, trend, 'buy', 'indic_5m') - indic_deriv1_5m = self.getParamValue(pair, trend, 'buy', 'indic_deriv1_5m') - indic_deriv2_5m = self.getParamValue(pair, trend, 'buy', 'indic_deriv2_5m') - - indic_5m_sell = self.getParamValue(pair, trend, 'sell', 'indic_5m_sell') - indic_deriv1_5m_sell = self.getParamValue(pair, trend, 'sell', 'indic_deriv1_5m_sell') - indic_deriv2_5m_sell = self.getParamValue(pair, trend, 'sell', 'indic_deriv2_5m_sell') + # trend = last_candle['trend_class_1d'] + # + # indic_5m = self.getParamValue(pair, trend, 'buy', 'indic_5m') + # indic_deriv1_5m = self.getParamValue(pair, trend, 'buy', 'indic_deriv1_5m') + # indic_deriv2_5m = self.getParamValue(pair, trend, 'buy', 'indic_deriv2_5m') + # + # indic_5m_sell = self.getParamValue(pair, trend, 'sell', 'indic_5m_sell') + # indic_deriv1_5m_sell = self.getParamValue(pair, trend, 'sell', 'indic_deriv1_5m_sell') + # indic_deriv2_5m_sell = self.getParamValue(pair, trend, 'sell', 'indic_deriv2_5m_sell') self.printLog( @@ -790,7 +791,7 @@ class Zeus_8_3_2_B_4_2(IStrategy): # f"|{last_candle['min60_1d']}|{last_candle['max60_1d']}" # f"|{last_candle['mid_smooth_tdc_5_1d'] or '-':>3}|{last_candle['mid_smooth_tdc_5_1h'] or '-':>3}|{last_candle['mid_smooth_tdc_5'] or '-':>3}" f"|{last_candle['mid_smooth_5_state_1d'] or '-':>3}|{last_candle['mid_smooth_24_state_1h'] or '-':>3}|{last_candle['mid_smooth_5_state_1h'] or '-':>3}|{last_candle['mid_smooth_5_state'] or '-':>3}" - f"|Params {last_candle['trend_class_1d']} {last_candle['trend_class_1h']}" # {indic_5m} {indic_deriv1_5m} {indic_deriv2_5m} {indic_5m_sell} {indic_deriv1_5m_sell} {indic_deriv2_5m_sell}" + f"|{last_candle['trend_class_1d']:>5} {last_candle['trend_class_1h']:>5}" # {indic_5m} {indic_deriv1_5m} {indic_deriv2_5m} {indic_5m_sell} {indic_deriv1_5m_sell} {indic_deriv2_5m_sell}" ) def getLastLost(self, last_candle, pair): @@ -1385,6 +1386,13 @@ class Zeus_8_3_2_B_4_2(IStrategy): & (dataframe['percent'] > 0) ), ['enter_long', 'enter_tag']] = (1, 'pct3') + dataframe.loc[ + ( + (dataframe["sma24"].shift(2) >= dataframe["sma24"].shift(1)) + & (dataframe["sma24"].shift(1) <= dataframe["sma24"]) + & (dataframe['percent3_1h'] < -0.03) + ), ['enter_long', 'enter_tag']] = (1, 'pct3_1h') + dataframe.loc[ ( (dataframe[f"{self.indic_5m_slope_sup_buy.value}"].shift(2) >= dataframe[f"{self.indic_5m_slope_sup_buy.value}"].shift(1)) @@ -1672,7 +1680,9 @@ class Zeus_8_3_2_B_4_2(IStrategy): if not self.should_enter_trade(pair, last_candle, current_time): return None - condition = (last_candle['enter_long'] and last_candle['sma5_deriv1'] > 0 and last_candle['hapercent'] > 0 and last_candle['stop_buying'] == False) or (last_candle['percent3'] < -0.03 and last_candle['percent'] > 0) + condition = (last_candle['enter_long'] and last_candle['sma60_deriv1'] > 0 and last_candle['hapercent'] > 0 and last_candle['stop_buying'] == False) \ + or last_candle['enter_tag'] == 'pct3' \ + or last_candle['enter_tag'] == 'pct3_1h' # if (self.getShortName(pair) != 'BTC' and count_of_buys > 3): # condition = before_last_candle_24['mid_smooth_3_1h'] > before_last_candle_12['mid_smooth_3_1h'] and before_last_candle_12['mid_smooth_3_1h'] < last_candle['mid_smooth_3_1h'] #and last_candle['mid_smooth_3_deriv1_1h'] < -1.5 @@ -1705,7 +1715,7 @@ class Zeus_8_3_2_B_4_2(IStrategy): stake_amount = min(min(max_amount, self.wallets.get_available_stake_amount()), self.adjust_stake_amount(pair, last_candle) * abs(last_lost / self.mise_factor_buy.value)) - if self.wallets.get_available_stake_amount() > stake_amount: + if stake_amount > 0: trade_type = last_candle['enter_tag'] if last_candle['enter_long'] == 1 else 'pct48' self.pairs[trade.pair]['count_of_buys'] += 1 self.pairs[pair]['total_amount'] += stake_amount @@ -1744,12 +1754,14 @@ class Zeus_8_3_2_B_4_2(IStrategy): # and last_candle['sma60_deriv1'] > 0 and last_candle['max_rsi_12_1h'] < 75 and last_candle['rsi_1d'] < 58 + and last_candle['stop_buying'] == False # and last_candle['mid_smooth_5_deriv1_1d'] > 0 + and self.wallets.get_available_stake_amount() > 0 ): try: self.pairs[pair]['previous_profit'] = profit - stake_amount = self.pairs[pair]['first_amount'] - if self.wallets.get_available_stake_amount() > stake_amount: + stake_amount = min(self.wallets.get_available_stake_amount(), self.pairs[pair]['first_amount']) + if stake_amount > 0: self.pairs[pair]['has_gain'] += 1 trade_type = 'Gain +'