@@ -1773,7 +1773,7 @@ class NostalgiaForInfinityNext(IStrategy):
17731773 sell_custom_stoploss_pump_ma_offset_3 = DecimalParameter (0.7 , 0.99 , default = 0.88 , space = 'sell' , decimals = 2 , optimize = False , load = True )
17741774
17751775 # Recover
1776- sell_custom_recover_profit_1 = DecimalParameter (0.01 , 0.06 , default = 0.04 , space = 'sell' , decimals = 3 , optimize = False , load = True )
1776+ sell_custom_recover_profit_1 = DecimalParameter (0.01 , 0.06 , default = 0.06 , space = 'sell' , decimals = 3 , optimize = False , load = True )
17771777 sell_custom_recover_min_loss_1 = DecimalParameter (0.06 , 0.16 , default = 0.12 , space = 'sell' , decimals = 3 , optimize = False , load = True )
17781778
17791779 sell_custom_recover_profit_min_2 = DecimalParameter (0.01 , 0.04 , default = 0.01 , space = 'sell' , decimals = 3 , optimize = False , load = True )
@@ -2004,6 +2004,15 @@ def sell_pump_extra(self, current_profit: float, last_candle, max_profit: float)
20042004
20052005 return False , None
20062006
2007+ def sell_recover (self , current_profit : float , last_candle , max_loss : float ) -> tuple :
2008+ if (max_loss > self .sell_custom_recover_min_loss_1 .value ) & (current_profit > self .sell_custom_recover_profit_1 .value ):
2009+ return True , 'signal_profit_r_1'
2010+
2011+ elif (max_loss > self .sell_custom_recover_min_loss_2 .value ) & (self .sell_custom_recover_profit_max_2 .value > current_profit > self .sell_custom_recover_profit_min_2 .value ) & (last_candle ['rsi' ] < self .sell_custom_recover_rsi_2 .value ) & (last_candle ['ema_25' ] < last_candle ['ema_50' ]):
2012+ return True , 'signal_profit_r_2'
2013+
2014+ return False , None
2015+
20072016 def custom_sell (self , pair : str , trade : 'Trade' , current_time : 'datetime' , current_rate : float ,
20082017 current_profit : float , ** kwargs ):
20092018 dataframe , _ = self .dp .get_analyzed_dataframe (pair , self .timeframe )
@@ -2068,6 +2077,11 @@ def custom_sell(self, pair: str, trade: 'Trade', current_time: 'datetime', curre
20682077 if (sell ) and (signal_name is not None ):
20692078 return signal_name
20702079
2080+ # Extra sells for trades that recovered
2081+ sell , signal_name = self .sell_recover (current_profit , last_candle , max_loss )
2082+ if (sell ) and (signal_name is not None ):
2083+ return signal_name
2084+
20712085 # Sell signal 1
20722086 if (self .sell_condition_1_enable .value ) & (last_candle ['rsi' ] > self .sell_rsi_bb_1 .value ) & (last_candle ['close' ] > last_candle ['bb20_2_upp' ]) & (previous_candle_1 ['close' ] > previous_candle_1 ['bb20_2_upp' ]) & (previous_candle_2 ['close' ] > previous_candle_2 ['bb20_2_upp' ]) & (previous_candle_3 ['close' ] > previous_candle_3 ['bb20_2_upp' ]) & (previous_candle_4 ['close' ] > previous_candle_4 ['bb20_2_upp' ]) & (previous_candle_5 ['close' ] > previous_candle_5 ['bb20_2_upp' ]):
20732087 return 'sell_signal_1'
0 commit comments