TEST HYPEROPTS

This commit is contained in:
Jérôme Delacotte
2026-03-07 15:36:28 +01:00
parent 5ce48130f4
commit 2885cf05b1
5 changed files with 1547 additions and 125 deletions

View File

@@ -216,8 +216,12 @@ class Empty(IStrategy):
# baisses = list()
# for i in range(0, 0.5, 0.05):
# baisses.append(i)
baisse = DecimalParameter(0, 0.5, decimals=2, default=0.3, space='protection', optimize=True, load=True)
b30_indicateur = CategoricalParameter(sma_indicators_h, default="sma36", space='protection', optimize=True, load=True)
mises = IntParameter(1, 10, default=1, space='protection')
sell_force_sell = DecimalParameter(-0.2, 0, decimals=3, default=-0.02, space='sell')
sell_indicator = CategoricalParameter(sma_indicators, default="sma36", space='sell', optimize=True, load=True)
baisse = DecimalParameter(0.1, 0.5, decimals=2, default=0.3, space='sell', optimize=True, load=True)
b30_indicateur = CategoricalParameter(sma_indicators_h, default="sma36", space='sell', optimize=True, load=True)
# lost_indicator = CategoricalParameter(sma_deriv1_indicators, default="sma5_deriv1", space='protection')
@@ -250,10 +254,10 @@ class Empty(IStrategy):
# sl_max = self.wallets.get_available_stake_amount() / 2
#
# amount = sl_min + (1 - range_pos) * (sl_max - sl_min)
if last_candle['enter_tag'] == 'fall':
if last_candle['enter_tag'] in ['fall', 'bear', 'Force', 'Range-']:
amount = self.wallets.get_available_stake_amount() / 5
else:
amount = self.wallets.get_available_stake_amount() # / (2 * self.pairs[pair]['count_of_lost'] + 1)
amount = self.wallets.get_available_stake_amount() / self.mises.value # / (2 * self.pairs[pair]['count_of_lost'] + 1)
# factor = 1
#
@@ -364,6 +368,8 @@ class Empty(IStrategy):
last_candle_2 = dataframe.iloc[-2].squeeze()
last_candle_3 = dataframe.iloc[-3].squeeze()
if entry_tag == 'Range-':
self.pairs[pair]['count_of_lost'] = 0
if entry_tag == 'Force':
if self.pairs[pair]['count_of_lost'] >= 1:
self.pairs[pair]['count_of_lost'] = 0
@@ -546,15 +552,15 @@ class Empty(IStrategy):
# buys=count_of_buys,
# stake=0
# )
# if self.pairs[pair]['current_trade'].enter_tag == 'fall':
# if current_profit < - 0.02 and last_candle[f"close"] <= last_candle['sma60'] and self.wallets.get_available_stake_amount() < 50:
# self.pairs[pair]['force_sell'] = True
# return 'sma60'
# else:
if current_profit < - 0.02 and last_candle[f"close"] <= last_candle['sma60']:
self.pairs[pair]['force_sell'] = True
return 'sma60'
if self.pairs[pair]['current_trade'].enter_tag in ['bear', 'Force', 'Range-']:
if current_profit < - 0.02 and last_candle[f"close"] <= last_candle['sma60'] and self.wallets.get_available_stake_amount() < 50:
self.pairs[pair]['force_sell'] = True
return 'smaBF'
else:
if current_profit < self.sell_force_sell.value \
and last_candle[f"close"] <= last_candle[self.sell_indicator.value]:
self.pairs[pair]['force_sell'] = True
return 'sma'
if profit > max(5, expected_profit) and \
(baisse > self.baisse.value and last_candle[f"close"] <= last_candle[self.b30_indicateur.value]) \
@@ -743,8 +749,8 @@ class Empty(IStrategy):
# #####################################################################################
# CA MONTE !!
# #####################################################################################
# conditions.append(dataframe[f"{self.start_bull_indicator.value}_deriv1_1d" ] > self.start_bull_deriv1.value)
# conditions.append(dataframe[f"{self.start_bull_indicator.value}_deriv2_1d"] > self.start_bull_deriv2.value)
conditions.append(dataframe[f"{self.start_bull_indicator.value}_deriv1_1d" ] > self.start_bull_deriv1.value)
conditions.append(dataframe[f"{self.start_bull_indicator.value}_deriv2_1d"] > self.start_bull_deriv2.value)
conditions.append(dataframe['sma12_deriv1'] > self.buy_deriv1_sma60.value)
conditions.append(dataframe['sma5_deriv1_1d'] > self.buy_deriv1_sma5d.value)
conditions.append(dataframe['sma12_deriv1_1d'] > self.buy_deriv1_sma12d.value)
@@ -791,11 +797,11 @@ class Empty(IStrategy):
conditions.append(dataframe['mid_smooth12'] > dataframe['mid_smooth12'].shift(1))
conditions.append(dataframe['sma100_deriv1_1d'] > 0)
conditions.append(dataframe[f"range_pos"] < 0.01)
if conditions:
dataframe.loc[
reduce(lambda x, y: x & y, conditions),
['enter_long', 'enter_tag']
] = (1, 'dist')
# if conditions:
# dataframe.loc[
# reduce(lambda x, y: x & y, conditions),
# ['enter_long', 'enter_tag']
# ] = (1, 'dist')
# #####################################################################################
# CA BAISSE !!
@@ -866,16 +872,17 @@ class Empty(IStrategy):
conditions.append(dataframe['sma12_deriv1_1d'] > 0.0)
conditions.append(dataframe['sma24_deriv1_1d'] > 0.0)
conditions.append(dataframe['sma100_deriv1_1d'] > 0.0)
conditions.append(dataframe[f"range_pos"] < 0.025)
# conditions.append(dataframe['sma12_deriv1_1d'] > 0.0)
# # conditions.append(dataframe['close_1d'] < dataframe[f'sma{self.buy_longue.value}_1d'])
# # conditions.append(dataframe['has_cross_min'].rolling(6).max() == 1)
# # conditions.append(dataframe['mid_smooth5'] > dataframe['mid_smooth5'].shift(1))
# conditions.append(dataframe['min12'] == dataframe['min12'].shift(3))
# conditions.append((dataframe['percent24'] < -0.025) | (dataframe['percent12'] < -0.025))
dataframe.loc[
reduce(lambda x, y: x & y, conditions),
['enter_long', 'enter_tag']
] = (1, 'Rise')
# dataframe.loc[
# reduce(lambda x, y: x & y, conditions),
# ['enter_long', 'enter_tag']
# ] = (1, 'Rise')
# conditions = list()
# conditions.append(dataframe['has_cross_min_6'] == True)
@@ -885,6 +892,14 @@ class Empty(IStrategy):
# ['enter_long', 'enter_tag']
# ] = (1, 'Force')
# conditions = list()
# conditions.append(dataframe['range_pos'] < -0.03)
# conditions.append(dataframe['min36'] == dataframe['min36'].shift(3))
# dataframe.loc[
# reduce(lambda x, y: x & y, conditions),
# ['enter_long', 'enter_tag']
# ] = (1, 'Range-')
return dataframe
def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: