Zeus_8_1d_Bilan.txt

This commit is contained in:
Jérôme Delacotte
2025-10-08 11:00:53 +02:00
parent 96d6d4b679
commit 67f617a5da
2 changed files with 248 additions and 26 deletions

View File

@@ -225,7 +225,7 @@ class Zeus_8_1d(IStrategy):
# paliers = {}
indicateur_achat_vente = 'mid_smooth_12';
indicateur_achat_vente = 'mid_smooth_12'
should_enter_trade_count = 0
@@ -305,7 +305,6 @@ class Zeus_8_1d(IStrategy):
self.pairs[pair]['last_sell'] = rate
self.pairs[pair]['last_trade'] = trade
self.pairs[pair]['last_candle'] = last_candle
self.pairs[pair]['max_profit'] = 0
self.trades = list()
dispo = round(self.wallets.get_available_stake_amount())
# print(f"Sell {pair} {current_time} {exit_reason} dispo={dispo} amount={amount} rate={rate} open_rate={trade.open_rate}")
@@ -319,6 +318,7 @@ class Zeus_8_1d(IStrategy):
dispo=dispo,
profit=round(trade.calc_profit(rate, amount), 2)
)
self.pairs[pair]['max_profit'] = 0
self.pairs[pair]['force_sell'] = False
self.pairs[pair]['has_gain'] = 0
self.pairs[pair]['current_profit'] = 0
@@ -402,14 +402,13 @@ class Zeus_8_1d(IStrategy):
# self.pairs[pair]['force_buy'] = (self.pairs[pair]['count_of_buys'] - self.pairs[pair]['has_gain'] > 5)
# return 'Baisse_' + pair_name + '_' + str(count_of_buys) + '_' + str(self.pairs[pair]['has_gain']) + '_' + str(round(baisse, 2))
# if before_last_candle_2['mid_smooth_5'] < before_last_candle['mid_smooth_5'] > last_candle['mid_smooth_5'] \
# and (profit > expected_profit or (profit > 0 and last_candle['max_rsi_12'] > 65)):
# self.pairs[pair]['force_sell'] = False
# self.pairs[pair]['force_buy'] = (self.pairs[pair]['count_of_buys'] - self.pairs[pair]['has_gain'] > 5)
# return 'RSI_' + pair_name + '_' + str(count_of_buys) + '_' + str(self.pairs[pair]['has_gain'])
if last_candle['mid_smooth_5_deriv1'] <= -0.1 and profit > expected_profit and last_candle['rsi'] > 65:
self.pairs[pair]['force_sell'] = False
self.pairs[pair]['force_buy'] = (self.pairs[pair]['count_of_buys'] - self.pairs[pair]['has_gain'] > 5)
return 'RSI_' + pair_name + '_' + str(count_of_buys) + '_' + str(self.pairs[pair]['has_gain']) + '_' + str(round(baisse, 2))
if before_last_candle_2[self.indicateur_achat_vente] < before_last_candle[self.indicateur_achat_vente] > last_candle[self.indicateur_achat_vente] \
and last_candle['mid_smooth_5_deriv1'] < 0 and profit > expected_profit:
if last_candle['mid_smooth_24_deriv1'] <= -0.1 \
and profit > expected_profit:
self.pairs[pair]['force_sell'] = False
self.pairs[pair]['force_buy'] = (self.pairs[pair]['count_of_buys'] - self.pairs[pair]['has_gain'] > 5)
return 'Drv3_' + pair_name + '_' + str(count_of_buys) + '_' + str(self.pairs[pair]['has_gain']) + '_' + str(round(baisse, 2))
@@ -770,18 +769,18 @@ class Zeus_8_1d(IStrategy):
N = 24 # nombre minimum de bougies avant inversion
rise_threshold = 1.0 # % de hausse à ne pas dépasser
# Calcul de la hausse minimale avant inversion
def compute_rise(idx):
if idx < N:
return 0
low_before = dataframe['close'].iloc[idx - N:idx].min() # min des N bougies avant inversion
return (dataframe['close'].iloc[idx] / low_before - 1) * 100
rise = [compute_rise(i) for i in range(len(dataframe))]
dataframe['rise_before_inversion'] = rise
# Filtre : inversion sans forte hausse avant
valid_inversion = inversion_last5 & (dataframe['rise_before_inversion'] <= rise_threshold)
# # Calcul de la hausse minimale avant inversion
# def compute_rise(idx):
# if idx < N:
# return 0
# low_before = dataframe['close'].iloc[idx - N:idx].min() # min des N bougies avant inversion
# return (dataframe['close'].iloc[idx] / low_before - 1) * 100
#
# rise = [compute_rise(i) for i in range(len(dataframe))]
# dataframe['rise_before_inversion'] = rise
#
# # Filtre : inversion sans forte hausse avant
# valid_inversion = inversion_last5 & (dataframe['rise_before_inversion'] <= rise_threshold)
# dataframe.loc[
# (
@@ -794,8 +793,10 @@ class Zeus_8_1d(IStrategy):
dataframe.loc[
(
# (valid_inversion & inversion_last5 )
(dataframe['mid_smooth_12'].shift(2) > dataframe['mid_smooth_12'].shift(1))
& (dataframe['mid_smooth_12'].shift(1) < dataframe['mid_smooth_12'])
# (dataframe['mid_smooth_12'].shift(2) > dataframe['mid_smooth_12'].shift(1))
# (dataframe['mid_smooth_24_deriv1'].shift(1) <= 0)
(dataframe['mid_smooth_24_deriv1'] >= 0.05)
& (dataframe['mid_smooth_24_deriv2'] > 0)
# & (dataframe['hapercent'] > 0)
#& (dataframe['max_rsi_12'] < 50)
# & (dataframe['open'] <= dataframe['bb_middleband'])
@@ -940,8 +941,7 @@ class Zeus_8_1d(IStrategy):
condition = (last_candle['sma5_deriv1'] > 0) # and \
limit_buy = 40
if (count_of_buys < limit_buy) and condition and (pct_max < lim):
if condition and (pct_max < lim):
try:
if self.pairs[pair]['has_gain']:
@@ -1115,7 +1115,7 @@ class Zeus_8_1d(IStrategy):
# if last_candle['close'] < max_60:
# pct_to_max = 0.25 * (max_60 - last_candle['close']) / max_60
# pct_to_max = pct_to_max * (2 - pctClose60)
expected_profit = lim * self.pairs[pair]['total_amount'] #min(3 * lim, max(lim, pct_to_max)) # 0.004 + 0.002 * self.pairs[pair]['count_of_buys'] #min(0.01, first_max)
expected_profit = lim #* self.pairs[pair]['total_amount'] #min(3 * lim, max(lim, pct_to_max)) # 0.004 + 0.002 * self.pairs[pair]['count_of_buys'] #min(0.01, first_max)
# print(
# f"Expected profit price={current_price:.4f} min_max={min_max:.4f} min_14={min_14_days:.4f} max_14={max_14_days:.4f} percent={percent:.4f} expected_profit={expected_profit:.4f}")