┏━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┓

┃ Strategy ┃ Trades ┃ Avg Profit % ┃ Tot Profit USDT ┃ Tot Profit % ┃    Avg Duration ┃  Win  Draw  Loss  Win% ┃           Drawdown ┃
┡━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━┩
│    Empty │     62 │         1.43 │        1238.641 │       123.86 │ 2 days, 2:15:00 │   43     0    19  69.4 │ 221.99 USDT  9.17% │
└──────────┴────────┴──────────────┴─────────────────┴──────────────┴─────────────────┴────────────────────────┴────────────────────┘
This commit is contained in:
Jérôme Delacotte
2026-02-25 19:23:21 +01:00
parent 70e1a57e47
commit 2c79bc706e
3 changed files with 169 additions and 143 deletions

View File

@@ -37,10 +37,13 @@ RESET = "\033[0m"
timeperiods = [3, 5, 12, 24, 36, 48, 60]
sma_indicators = list()
score_indicators = list()
stop_buying_indicators = list()
god_genes_with_timeperiod = list()
for timeperiod in timeperiods:
sma_indicators.append(f"sma{timeperiod}")
sma_indicators.append(f"sma{timeperiod}_1d")
# god_genes_with_timeperiod.append(f'max{timeperiod}')
# god_genes_with_timeperiod.append(f'min{timeperiod}')
# god_genes_with_timeperiod.append(f"percent{timeperiod}")
@@ -363,9 +366,13 @@ class Empty(IStrategy):
}
}
buy_deriv_sma60 = DecimalParameter(-0.005, 0.005, decimals=3, default=0, space='buy')
buy_deriv_sma5d = DecimalParameter(-0.07, 0.07, decimals=2, default=0, space='buy')
buy_deriv_sma12d = DecimalParameter(-0.07, 0.07, decimals=2, default=0, space='buy')
buy_deriv1_sma60 = DecimalParameter(-0.005, 0.005, decimals=3, default=0, space='buy')
buy_deriv1_sma5d = DecimalParameter(-0.07, 0.07, decimals=2, default=0, space='buy')
buy_deriv1_sma12d = DecimalParameter(-0.07, 0.07, decimals=2, default=0, space='buy')
buy_deriv2_sma60 = DecimalParameter(-0.005, 0.005, decimals=3, default=0, space='buy')
buy_deriv2_sma5d = DecimalParameter(-0.07, 0.07, decimals=2, default=0, space='buy')
buy_deriv2_sma12d = DecimalParameter(-0.07, 0.07, decimals=2, default=0, space='buy')
# Buy Hyperoptable Parameters/Spaces.
# buy_crossed_indicator0 = CategoricalParameter(god_genes_with_timeperiod, default="ADD-20", space='buy')
@@ -403,9 +410,12 @@ class Empty(IStrategy):
sell_score_indicator = CategoricalParameter(score_indicators, default="sma24_score", space='sell')
sell_sma_indicators = CategoricalParameter(sma_indicators, default="sma24_score", space='sell')
sell_crossed_sma_indicators = CategoricalParameter(sma_indicators, default="sma24_score", space='sell')
drop_from_last_entry = DecimalParameter(-0.1, 0, decimals=2, default=-0.025, space='protection')
range_pos_stoploss = DecimalParameter(0, 0.1, decimals=2, default=0.05, space='protection')
stoploss_force = DecimalParameter(-0.2, 0, decimals=2, default=-0.05, space='protection')
# range_pos_stoploss = DecimalParameter(0, 0.1, decimals=2, default=0.05, space='protection')
# stoploss_force = DecimalParameter(-0.2, 0, decimals=2, default=-0.05, space='protection')
# stoploss_timeperiod = CategoricalParameter(timeperiods, default="12", space='protection')
@@ -698,11 +708,16 @@ class Empty(IStrategy):
self.pairs[pair]['force_sell'] = True
return 'sma60'
cross = qtpylib.crossed_below(dataframe[self.sell_sma_indicators.value], dataframe[self.sell_crossed_sma_indicators.value])
if profit > 0 and cross.iloc[-1]:
self.pairs[pair]['force_sell'] = True
return 'Cross'
if profit > max(5, expected_profit) and baisse > 0.30 and last_candle[f"close"] <= last_candle['sma5']\
and last_candle['percent3'] < 0 and last_candle['percent5'] < 0:
self.pairs[pair]['force_sell'] = True
self.pairs[pair]['force_buy'] = (self.pairs[pair]['count_of_buys'] - self.pairs[pair]['has_gain'] > 3)
return str(count_of_buys) + '_' + 'B30_' + pair + '_' + str(self.pairs[pair]['has_gain'])
return 'B30'
# if last_candle['range_pos'] > 0.05 and current_profit < - last_candle['range_pos'] /4 : #last_candle['cross_sma60']:
# self.pairs[pair]['force_sell'] = True
@@ -828,7 +843,9 @@ class Empty(IStrategy):
range_max = dataframe[f"max48"]
dataframe[f"range_pos"] = ((dataframe['mid'] - range_min) / (range_max)).rolling(5).mean()
dataframe['cross_sma60'] = qtpylib.crossed_below(dataframe['sma12'], dataframe['sma5_1d'])
# dataframe['cross_sma60'] = qtpylib.crossed_below(dataframe[self.sell_sma_indicators.value], dataframe[self.sell_crossed_sma_indicators.value])
dataframe[f'stop_buying'] = qtpylib.crossed_below(dataframe[f"sma12"], dataframe['sma48'])
dataframe['rsi'] = talib.RSI(dataframe['close'], timeperiod=14)
@@ -902,12 +919,21 @@ class Empty(IStrategy):
#conditions.append((dataframe[self.stop_buying_indicator.value] == False) | (dataframe['range_pos'] < 0))
conditions.append(dataframe['sma60_deriv1'] > self.buy_deriv_sma60.value)
conditions.append(dataframe['sma5_deriv1_1d'] > self.buy_deriv_sma5d.value)
conditions.append(dataframe['sma12_deriv1_1d'] > self.buy_deriv_sma12d.value)
conditions.append(dataframe['sma60_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)
conditions.append(dataframe['sma60_deriv2'] > self.buy_deriv1_sma60.value)
conditions.append(dataframe['sma5_deriv2_1d'] > self.buy_deriv1_sma5d.value)
conditions.append(dataframe['sma12_deriv2_1d'] > self.buy_deriv1_sma12d.value)
conditions.append(dataframe['hapercent'] > 0)
conditions.append(dataframe['max_rsi_24'] < 80)
conditions.append(dataframe['max_rsi_12_1d'] < 65)
conditions.append((dataframe['max_rsi_12_1d'] < 65))\
# | (
# (dataframe['sma5_deriv1'] > 0) & (dataframe['sma12_deriv1'] > 0) & (dataframe['sma24_deriv1'] > 0) & (
# dataframe['sma48_deriv1'] > 0) & (dataframe['sma60_deriv1'] > 0) & (dataframe['sma5_deriv1_1d'] > 0))
# )
conditions.append(dataframe[f"close"] > dataframe['sma60'])
conditions.append(((dataframe[f"range_pos"] < 0.05) ) | ((dataframe['sma12_deriv1'] > 0) & (dataframe['sma12_deriv2'] > 0)))