changement calcul expected profit à partir du 1er prix d'achat

This commit is contained in:
Jérôme Delacotte
2025-05-02 18:15:48 +02:00
parent 9cdf7e47cc
commit d2378b0b63

View File

@@ -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}")