Compare commits

..

6 Commits

Author SHA1 Message Date
Jérôme Delacotte
8b581e5a39 Zeus_8_3_2_B_4_2 2025-10-21 11:31:41 +02:00
Jérôme Delacotte
b4b9669ee0 Zeus_8_3_2_B_4_2 2025-10-21 11:31:04 +02:00
Jérôme Delacotte
7640b204dd Zeus_8_3_2_B_4_2 2025-10-21 11:31:04 +02:00
Jérôme Delacotte
1a438686b0 Zeus_8_3_2_B_4_2 2025-10-21 11:31:04 +02:00
Jérôme Delacotte
f3f949455f Zeus_8_3_2_B_4_2 2025-10-21 11:31:04 +02:00
Jérôme Delacotte
0ee3916eb4 Zeus_8_3_2_B_4_2 2025-10-21 11:31:04 +02:00

View File

@@ -509,22 +509,20 @@ class Zeus_8_3_2_B_4_2(IStrategy):
factor = 1 factor = 1
if (self.getShortName(pair) == 'BTC'): if (self.getShortName(pair) == 'BTC'):
factor = 0.5 factor = 0.5
if baisse > 2 and baisse > factor * self.pairs[pair]['total_amount'] / 100: # 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) :
# self.pairs[pair]['force_sell'] = False # 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: 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_sell'] = False
self.pairs[pair]['force_buy'] = (self.pairs[pair]['count_of_buys'] - self.pairs[pair]['has_gain'] > 5) 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 4 <= count_of_buys <= 6:
# if ((before_last_candle_2['mid_smooth_12_deriv1'] <= before_last_candle['mid_smooth_12_deriv1']) # 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() self.printLineLog()
df = pd.DataFrame.from_dict(self.pairs, orient='index') df = pd.DataFrame.from_dict(self.pairs, orient='index')
colonnes_a_exclure = ['last_candle', 'last_trade', 'last_palier_index', 'current_trade', 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[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'] # 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']) # print(metadata['pair'])
dataframe['rsi'] = talib.RSI(dataframe['close'], timeperiod=14) 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) self.calculeDerivees(dataframe, 'rsi', horizon=12)
dataframe['max48'] = talib.MAX(dataframe['close'], timeperiod=48) 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 ) # (valid_inversion & inversion_last5 )
(dataframe['mid_smooth_3'].shift(1) < dataframe['mid_smooth_3']) (dataframe['mid_smooth_3'].shift(1) < dataframe['mid_smooth_3'])
& (dataframe['hapercent'] > 0) & (dataframe['hapercent'] > 0)
& (dataframe['max_rsi_12'] < 70) & (dataframe['max_rsi_24'] < 70)
& (dataframe['open'] <= dataframe['bb_middleband']) & (dataframe['open'] <= dataframe['bb_middleband'])
# valid_inversion # valid_inversion
@@ -1173,8 +1171,8 @@ class Zeus_8_3_2_B_4_2(IStrategy):
# & (dataframe['close'] * factor < dataframe['bb_upperband5']) # & (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'].shift(1) <= 0)
# & (dataframe['mid_smooth_1h_deriv1'] >= dataframe['mid_smooth_1h_deriv1'].shift(1)) # & (dataframe['mid_smooth_1h_deriv1'] >= dataframe['mid_smooth_1h_deriv1'].shift(1))
), ['enter_long', 'enter_tag']] = (1, 'smth') ), ['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['rsi_deriv1_1h'] > 0
and last_candle['mid_smooth_5_deriv1_1d'] > 0 and last_candle['mid_smooth_5_deriv1_1d'] > 0
and last_candle['sma60_deriv1'] > 0 and last_candle['sma60_deriv1'] > 0
and last_candle['sma60_deriv2'] > 0
): ):
try: try:
stake_amount = self.pairs[pair]['first_amount'] / 2 stake_amount = self.pairs[pair]['first_amount'] / 2
@@ -1731,10 +1730,13 @@ class Zeus_8_3_2_B_4_2(IStrategy):
# pct_to_max = pct_to_max * (2 - pctClose60) # 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)
self.pairs[pair]['expected_profit'] = expected_profit
# print( # 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}") # 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 return expected_profit
def calculateUpDownPct(self, dataframe, key): def calculateUpDownPct(self, dataframe, key):
down_pct_values = np.full(len(dataframe), np.nan) down_pct_values = np.full(len(dataframe), np.nan)
# Remplir la colonne avec les bons calculs # Remplir la colonne avec les bons calculs