diff --git a/Zeus_8_3_2_B_4_2.py b/Zeus_8_3_2_B_4_2.py index 62ebc25..f156145 100644 --- a/Zeus_8_3_2_B_4_2.py +++ b/Zeus_8_3_2_B_4_2.py @@ -494,8 +494,8 @@ class Zeus_8_3_2_B_4_2(IStrategy): def tag_by_derivatives(row): d1 = row['mid_smooth_deriv1'] d2 = row['mid_smooth_deriv2'] - d1_lim_inf = -5 - d1_lim_sup = 5 + d1_lim_inf = -0.01 + d1_lim_sup = 0.01 if d1 >= d1_lim_inf and d1 <= d1_lim_sup: # and d2 >= d2_lim_inf and d2 <= d2_lim_sup: return 'P' # Palier if d1 == 0.0: @@ -797,12 +797,12 @@ class Zeus_8_3_2_B_4_2(IStrategy): def calculateTendency(self, dataframe, window=12): dataframe['mid'] = dataframe['open'] + (dataframe['close'] - dataframe['open']) / 2 # 2. Calcul du lissage sur 200 bougies par moyenne mobile médiane - dataframe['mid_smooth'] = dataframe['mid'].rolling(window=window, center=True, min_periods=1).median().rolling( + dataframe['mid_smooth'] = dataframe['close'].rolling(window=window, center=True, min_periods=1).median().rolling( 3).mean() # 2. Dérivée première = différence entre deux bougies successives - dataframe['mid_smooth_deriv1'] = round(100000 * dataframe['mid_smooth'].pct_change(), 2) + dataframe['mid_smooth_deriv1'] = round(100 * dataframe['mid_smooth'].diff() / dataframe['mid_smooth'], 4) # 3. Dérivée seconde = différence de la dérivée première - dataframe['mid_smooth_deriv2'] = round(100 * dataframe['mid_smooth_deriv1'].pct_change().rolling(3).mean(), 2) + dataframe['mid_smooth_deriv2'] = round(100 * dataframe['mid_smooth_deriv1'].diff().rolling(3).mean(), 4) dataframe = self.add_tendency_column(dataframe) return dataframe @@ -898,6 +898,7 @@ class Zeus_8_3_2_B_4_2(IStrategy): # (dataframe["bb_width"] > 0.01) (dataframe['down_count'].shift(1) < - 1) & (dataframe['down_count'] == 0) + & (dataframe['mid_smooth_deriv1'] >= -0.01) # & (dataframe['tendency'] != "B--") # & (dataframe['tendency'] != "B-") ), ['enter_long', 'enter_tag']] = (1, 'down') @@ -906,15 +907,10 @@ class Zeus_8_3_2_B_4_2(IStrategy): ( (dataframe['low'] < dataframe['min200']) & (dataframe['min50'] == dataframe['min50'].shift(3)) - # & (dataframe['tendency'] != "B--") - # & (dataframe['tendency'] != "B-") + # + & (dataframe['tendency'] != "B-") ), ['enter_long', 'enter_tag']] = (1, 'low') - # dataframe.loc[ - # ( - # (dataframe['mid_smooth_deriv1'] > 0) - # & (dataframe['rsi'] < 50) - # & (dataframe['mid_smooth_deriv1'] > dataframe['mid_smooth_deriv1'].shift(1) * 1.5) - # ), ['enter_long', 'enter_tag']] = (1, 'mid') + dataframe['test'] = np.where(dataframe['enter_long'] == 1, dataframe['close'] * 1.01, np.nan) @@ -1079,12 +1075,12 @@ class Zeus_8_3_2_B_4_2(IStrategy): def expectedProfit(self, pair: str, last_candle: DataFrame): - first_price = last_candle['first_price'] - first_max = 0.01 - if first_price < last_candle['max200']: - first_max = (last_candle['max200'] - first_price) / first_price + # first_price = last_candle['first_price'] + # first_max = 0.01 + # if first_price < last_candle['max200']: + # first_max = (last_candle['max200'] - first_price) / first_price - expected_profit = min(0.01, first_max) + expected_profit = 0.004 #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}")