Zeus_8_3_2_B_4_2

This commit is contained in:
Jérôme Delacotte
2025-10-20 20:52:25 +02:00
parent 4c0692426e
commit 0ee3916eb4

View File

@@ -509,22 +509,20 @@ class Zeus_8_3_2_B_4_2(IStrategy):
factor = 1
if (self.getShortName(pair) == 'BTC'):
factor = 0.5
if baisse > 2 and baisse > factor * self.pairs[pair]['total_amount'] / 100:
self.pairs[pair]['force_sell'] = False
self.pairs[pair]['force_buy'] = (self.pairs[pair]['count_of_buys'] - self.pairs[pair]['has_gain'] > 3)
return 'Baisse_' + pair_name + '_' + str(count_of_buys) + '_' + str(self.pairs[pair]['has_gain'])
#
# # if 1 <= count_of_buys <= 3:
# if last_candle['rsi_1h'] < 50 \
# and last_candle['mid_smooth_1h_deriv1'] < 0 and profit > expected_profit \
# and (last_candle['sma20'] - before_last_candle['sma20'] < 0) :
# if baisse > 2 and baisse > factor * self.pairs[pair]['total_amount'] / 100:
# self.pairs[pair]['force_sell'] = False
# return 'Drv3_' + pair_name + '_' + str(count_of_buys) + '_' + str(self.pairs[pair]['has_gain'])
# self.pairs[pair]['force_buy'] = (self.pairs[pair]['count_of_buys'] - self.pairs[pair]['has_gain'] > 3)
# return 'Baisse_' + pair_name + '_' + str(count_of_buys) + '_' + str(self.pairs[pair]['has_gain'])
#
# if 1 <= count_of_buys <= 3:
if last_candle['max_rsi_24'] > 75 and profit > expected_profit and (last_candle['hapercent'] < 0) :
self.pairs[pair]['force_sell'] = False
return str(count_of_buys) + '_' + 'Rsi_' + pair_name + '_' + str(self.pairs[pair]['has_gain'])
if last_candle['mid_smooth_1h_deriv1'] < 0 and last_candle['rsi_1h'] < 50 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'])
return str(count_of_buys) + '_' + 'Drv3_' + pair_name + '_' + str(self.pairs[pair]['has_gain'])
# if 4 <= count_of_buys <= 6:
# if ((before_last_candle_2['mid_smooth_12_deriv1'] <= before_last_candle['mid_smooth_12_deriv1'])
@@ -597,7 +595,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
self.printLineLog()
df = pd.DataFrame.from_dict(self.pairs, orient='index')
colonnes_a_exclure = ['last_candle', 'last_trade', 'last_palier_index', 'current_trade',
'trade_info', 'last_date', 'expected_profit', 'last_count_of_buys', 'base_stake_amount', 'stop_buy']
'trade_info', 'last_date', 'last_count_of_buys', 'base_stake_amount', 'stop_buy']
df_filtered = df[df['count_of_buys'] > 0].drop(columns=colonnes_a_exclure)
# df_filtered = df_filtered["first_buy", "last_max", "max_touch", "last_sell","last_buy", 'count_of_buys', 'current_profit']
@@ -771,7 +769,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
# print(metadata['pair'])
dataframe['rsi'] = talib.RSI(dataframe['close'], timeperiod=14)
dataframe['max_rsi_12'] = talib.MAX(dataframe['rsi'], timeperiod=12)
dataframe['max_rsi_24'] = talib.MAX(dataframe['rsi'], timeperiod=24)
self.calculeDerivees(dataframe, 'rsi', horizon=12)
dataframe['max48'] = talib.MAX(dataframe['close'], timeperiod=48)
@@ -1160,7 +1158,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
# (valid_inversion & inversion_last5 )
(dataframe['mid_smooth_3'].shift(1) < dataframe['mid_smooth_3'])
& (dataframe['hapercent'] > 0)
& (dataframe['max_rsi_12'] < 70)
& (dataframe['max_rsi_24'] < 70)
& (dataframe['open'] <= dataframe['bb_middleband'])
# valid_inversion
@@ -1173,8 +1171,8 @@ class Zeus_8_3_2_B_4_2(IStrategy):
# & (dataframe['close'] * factor < dataframe['bb_upperband5'])
#
#
# (dataframe['mid_smooth_1h_deriv1'] >= 0)
# & (dataframe['mid_smooth_1h_deriv1'] >= 0)
& (dataframe['mid_smooth_1h_deriv1'] >= 0)
& (dataframe['mid_smooth_1h_deriv2'] >= 0)
# & (dataframe['mid_smooth_1h_deriv1'].shift(1) <= 0)
# & (dataframe['mid_smooth_1h_deriv1'] >= dataframe['mid_smooth_1h_deriv1'].shift(1))
), ['enter_long', 'enter_tag']] = (1, 'smth')
@@ -1547,6 +1545,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
and last_candle['rsi_deriv1_1h'] > 0
and last_candle['mid_smooth_5_deriv1_1d'] > 0
and last_candle['sma60_deriv1'] > 0
and last_candle['sma60_deriv2'] > 0
):
try:
stake_amount = self.pairs[pair]['first_amount'] / 2
@@ -1731,6 +1730,8 @@ class Zeus_8_3_2_B_4_2(IStrategy):
# 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)
self.pairs[pair]['expected_profit'] = expected_profit
# 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}")
return expected_profit