Skip to content

Commit 1a6ca63

Browse files
committed
Sell with loss (stoploss) for pumped pairs
1 parent 43bc2b0 commit 1a6ca63

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

NostalgiaForInfinityNext.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,7 +1963,7 @@ def sell_under_min(self, current_profit: float, last_candle) -> tuple:
19631963

19641964
return False, None
19651965

1966-
def sell_stoploss(self, current_profit: float, last_candle, trade: 'Trade', current_time: 'datetime', max_loss: float) -> tuple:
1966+
def sell_stoploss(self, current_profit: float, last_candle, trade: 'Trade', current_time: 'datetime', max_loss: float, max_profit: float) -> tuple:
19671967
if (current_profit < -0.0) & (last_candle['close'] < last_candle['ema_200']) & (((last_candle['ema_200'] - last_candle['close']) / last_candle['close']) < self.sell_custom_stoploss_under_rel_1.value) & (last_candle['rsi'] > last_candle['rsi_1h'] + self.sell_custom_stoploss_under_rsi_diff_1.value) & (last_candle['cmf'] < 0.0) & (last_candle['sma_200_dec_24']) & (current_time - timedelta(minutes=720) > trade.open_date_utc):
19681968
return True, 'signal_stoploss_u_1'
19691969

@@ -1973,6 +1973,12 @@ def sell_stoploss(self, current_profit: float, last_candle, trade: 'Trade', curr
19731973
elif (current_profit < -0.0) & (current_profit > (-max_loss + self.sell_custom_stoploss_long_recover_2.value)) & (last_candle['close'] < last_candle['ema_200']) & (last_candle['cmf'] < 0.0) & (last_candle['rsi'] > last_candle['rsi_1h'] + self.sell_custom_stoploss_long_rsi_diff_2.value) & (last_candle['sma_200_dec_24']) & (current_time - timedelta(minutes=1200) > trade.open_date_utc):
19741974
return True, 'signal_stoploss_l_r_u_2'
19751975

1976+
elif (max_profit < self.sell_custom_stoploss_pump_max_profit_2.value) & (current_profit < self.sell_custom_stoploss_pump_loss_2.value) & (last_candle['sell_pump_48_1_1h']) & (last_candle['cmf'] < 0.0) & (last_candle['sma_200_dec_20_1h']) & (last_candle['close'] < (last_candle['ema_200'] * self.sell_custom_stoploss_pump_ma_offset_2.value)):
1977+
return True, 'signal_stoploss_p_2'
1978+
1979+
elif (max_profit < self.sell_custom_stoploss_pump_max_profit_3.value) & (current_profit < self.sell_custom_stoploss_pump_loss_3.value) & (last_candle['sell_pump_36_3_1h']) & (last_candle['close'] < (last_candle['ema_200'] * self.sell_custom_stoploss_pump_ma_offset_3.value)):
1980+
return True, 'signal_stoploss_p_3'
1981+
19761982
return False, None
19771983

19781984
def sell_pump_dec(self, current_profit: float, last_candle) -> tuple:
@@ -2048,7 +2054,7 @@ def custom_sell(self, pair: str, trade: 'Trade', current_time: 'datetime', curre
20482054
return signal_name
20492055

20502056
# Stoplosses
2051-
sell, signal_name = self.sell_stoploss(current_profit, last_candle, trade, current_time, max_loss)
2057+
sell, signal_name = self.sell_stoploss(current_profit, last_candle, trade, current_time, max_loss, max_profit)
20522058
if (sell) and (signal_name is not None):
20532059
return signal_name
20542060

0 commit comments

Comments
 (0)