From 8b030f46f00669e87c2e8760ed66b782d69e8745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Delacotte?= Date: Sat, 28 Mar 2026 21:51:37 +0100 Subject: [PATCH] TEST SHORT --- EmptyShort.json | 2 +- EmptyShort.py | 81 ++++++++++++++++++++++++++++--------------------- 2 files changed, 48 insertions(+), 35 deletions(-) diff --git a/EmptyShort.json b/EmptyShort.json index b401b03..bd13dd2 100644 --- a/EmptyShort.json +++ b/EmptyShort.json @@ -5,7 +5,7 @@ "0": 5 }, "stoploss": { - "stoploss": -1.0 + "stoploss": -0.02 }, "trailing": { "trailing_stop": false, diff --git a/EmptyShort.py b/EmptyShort.py index ec40dde..aab3910 100644 --- a/EmptyShort.py +++ b/EmptyShort.py @@ -458,7 +458,7 @@ class EmptyShort(IStrategy): self.log_trade( last_candle=last_candle, date=current_time, - action=("🟩Buy" if allow_to_buy else "Canceled") + " " + str(minutes), + action=("🟩Buy") + " " + str(minutes), pair=pair, rate=rate, dispo=dispo, @@ -471,7 +471,7 @@ class EmptyShort(IStrategy): self.log_trade( last_candle=last_candle, date=current_time, - action=("🟩Buy" if allow_to_buy else "Canceled") + " " + reason, + action=("Canceled") + " " + reason, pair=pair, rate=rate, dispo=dispo, @@ -569,11 +569,11 @@ class EmptyShort(IStrategy): # self.pairs[pair]['force_sell'] = True # return 'sma' # - if current_profit > tp_price and \ - (baisse > self.baisse.value and last_candle[f"close"] > last_candle[self.b30_indicateur.value]) \ - and last_candle['hapercent'] > 0: - self.pairs[pair]['force_sell'] = True - return 'B30Sht' + # if current_profit > tp_price and \ + # (baisse > self.baisse.value and last_candle[f"close"] > last_candle[self.b30_indicateur.value]) \ + # and last_candle['hapercent'] > 0: + # self.pairs[pair]['force_sell'] = True + # return 'B30Sht' return None # self.log_trade( @@ -840,10 +840,10 @@ class EmptyShort(IStrategy): dataframe = merge_informative_pair(dataframe, informative, self.timeframe, "1d", ffill=True) # ###################################################################################################### - range_min = dataframe[f"min12_1h"] - range_max = dataframe[f"max48"] + range_min = dataframe[f"min12_1d"] + range_max = dataframe[f"max12_1d"] - dataframe[f"range_pos"] = ((dataframe['mid'] - range_min) / (range_max)).rolling(5).mean() + dataframe[f"range_pos"] = ((dataframe['mid'] - range_min) / (range_max - range_min)) #.rolling(5).mean() # dataframe['cross_sma60'] = qtpylib.crossed_below(dataframe[self.sell_sma_indicators.value], dataframe[self.sell_crossed_sma_indicators.value]) @@ -1039,14 +1039,16 @@ class EmptyShort(IStrategy): # ['enter_long', 'enter_tag'] # ] = (1, 'Mid') - # dataframe.loc[ - # ( - # # (qtpylib.crossed_above(dataframe['sma60'], dataframe['mid_regression_1h'])) - # (dataframe['rsi_1h'] <= 30) - # & (dataframe['min_rsi_12_1h'] == dataframe['rsi_1h']) - # ), - # ['enter_long', 'enter_tag'] - # ] = (1, 'long') + dataframe.loc[ + ( + # (qtpylib.crossed_above(dataframe['sma60'], dataframe['mid_regression_1h'])) + (dataframe['sma12_1h'] > dataframe['sma12_1h'].shift(61)) + & (dataframe['range_pos'] < 0.05) + & (dataframe['close'] < dataframe['close_1d']) + & (dataframe['close'] < dataframe['close_1h']) + ), + ['enter_long', 'enter_tag'] + ] = (1, 'long') dataframe.loc[ ( @@ -1063,9 +1065,11 @@ class EmptyShort(IStrategy): # (dataframe['rsi_1h'] >= 65) # & (dataframe['max_rsi_12_1h'] == dataframe['rsi_1h']) # & (dataframe['hapercent'] < 0) - # & (dataframe['sma60'] < dataframe['sma60'].shift(1)) + # (dataframe['sma12_1h'] < dataframe['sma12_1h'].shift(61)) + & (dataframe['range_pos'] > 0.05) & (dataframe['close'] > dataframe['close_1d']) + & (dataframe['close'] > dataframe['close_1h']) ) ), ['enter_short', 'enter_tag'] @@ -1141,17 +1145,19 @@ class EmptyShort(IStrategy): # if conditions: # dataframe.loc[reduce(lambda x, y: x & y, conditions), ['exit_long', 'exit_tag']] = (1, 'god') - # dataframe.loc[ - # ( - # # (qtpylib.crossed_above( - # # dataframe['sma'], - # # dataframe['mid_regression_1h']) - # # ) - # (dataframe['rsi_1h'] >= 70) - # & (dataframe['max_rsi_12_1h'] == dataframe['rsi_1h']) - # ), - # ['exit_long', 'exit_tag'] - # ] = (1, 'long') + dataframe.loc[ + ( + # (qtpylib.crossed_above( + # dataframe['sma'], + # dataframe['mid_regression_1h']) + # ) + (dataframe['sma12_1h'] < dataframe['sma12_1h'].shift(61)) + & (dataframe['range_pos'] > 0.01) + & (dataframe['close'] > dataframe['close_1d']) + & (dataframe['close'] > dataframe['close_1h']) + ), + ['exit_long', 'exit_tag'] + ] = (1, 'long') dataframe.loc[ ( @@ -1159,10 +1165,17 @@ class EmptyShort(IStrategy): # dataframe['sma'], # dataframe['mid_regression_1h']) # ) - (dataframe['rsi_1h'] <= 30) - & (dataframe['min_rsi_12_1h'] == dataframe['rsi_1h']) - & (dataframe['hapercent'] > 0) - & (dataframe['sma60'] >= dataframe['sma60'].shift(1)) + + # (dataframe['rsi_1h'] <= 30) + # & (dataframe['min_rsi_12_1h'] == dataframe['rsi_1h']) + # & (dataframe['hapercent'] > 0) + # & (dataframe['sma60'] >= dataframe['sma60'].shift(1)) + + (dataframe['sma12_1h'] > dataframe['sma12_1h'].shift(61)) + & (dataframe['range_pos'] < 0.01) + & (dataframe['close'] < dataframe['close_1d']) + & (dataframe['close'] < dataframe['close_1h']) + ), ['exit_short', 'exit_tag'] ] = (1, 'short')