TEST SHORT

This commit is contained in:
Jérôme Delacotte
2026-03-28 21:51:37 +01:00
parent 2a7dd0beb4
commit 8b030f46f0
2 changed files with 48 additions and 35 deletions

View File

@@ -5,7 +5,7 @@
"0": 5
},
"stoploss": {
"stoploss": -1.0
"stoploss": -0.02
},
"trailing": {
"trailing_stop": false,

View File

@@ -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')