From d2378b0b635473b1c1412898dfb76b1c4749f67a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Delacotte?= Date: Fri, 2 May 2025 18:15:48 +0200 Subject: [PATCH] =?UTF-8?q?changement=20calcul=20expected=20profit=20?= =?UTF-8?q?=C3=A0=20partir=20du=201er=20prix=20d'achat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zeus_8_3_2_B_4_2.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/Zeus_8_3_2_B_4_2.py b/Zeus_8_3_2_B_4_2.py index 45e4482..49907ff 100644 --- a/Zeus_8_3_2_B_4_2.py +++ b/Zeus_8_3_2_B_4_2.py @@ -773,7 +773,7 @@ class Zeus_8_3_2_B_4_2(IStrategy): dataframe.loc[ ( (dataframe['low'] < dataframe['min200']) - & (dataframe['min50'] == dataframe['min200'].shift(3)) + & (dataframe['min50'] == dataframe['min50'].shift(3)) # & (dataframe['tendency'] != "B--") # & (dataframe['tendency'] != "B-") ), ['enter_long', 'enter_tag']] = (1, 'low') @@ -965,21 +965,12 @@ class Zeus_8_3_2_B_4_2(IStrategy): # # Retourner le stoploss dynamique en pourcentage du prix actuel # return (atr_stoploss / current_rate) - 1 - def expectedProfit(self, pair: str, dataframe: DataFrame): + def expectedProfit(self, pair: str, last_candle: DataFrame): - current_price = dataframe['last_price'] # dataframe['close'] + first_price = last_candle['first_price'] + first_max = (last_candle['max200'] - first_price) / first_price - # trade = self.getTrade(pair) - # if trade: - # current_price = trade.open_rate - - # Calculer le max des 14 derniers jours - min_14_days = dataframe['lowest_1d'] - max_14_days = dataframe['highest_1d'] - percent = (max_14_days - current_price) / (min_14_days) - - min_max = dataframe['pct_min_max_1d'] # (max_14_days - min_14_days) / min_14_days - expected_profit = min(0.01, max(0.01, dataframe['min_max200'] * 0.5)) + expected_profit = min(0.01, first_max * 0.5) # 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}")