@@ -2681,29 +2681,16 @@ def sell_under_min(self, current_profit: float, last_candle) -> tuple:
2681
2681
2682
2682
return False , None
2683
2683
2684
- def sell_stoploss (self , current_profit : float , last_candle , trade : 'Trade' , current_time : 'datetime' , max_loss : float , max_profit : float ) -> tuple :
2685
- 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.2 ) & (last_candle ['sma_200_dec_24' ]) & (current_time - timedelta (minutes = 720 ) > trade .open_date_utc ):
2686
- return True , 'signal_stoploss_u_1'
2687
-
2688
- # Under EMA200, pair & BTC negative, low max rate
2689
- elif (- 0.1 > current_profit > - 0.14 ) & (last_candle ['btc_not_downtrend_1h' ] == False ) & (last_candle ['moderi_32' ] == False ) & (last_candle ['moderi_64' ] == False ) & (max_profit < 0.005 ) & (max_loss < 0.14 ) & (last_candle ['sma_200_dec_24' ]) & (last_candle ['cmf' ] < - 0.0 ) & (last_candle ['close' ] < last_candle ['ema_200' ]) & (last_candle ['ema_25' ] < last_candle ['ema_50' ]) & (last_candle ['cti' ] < - 0.8 ) & (last_candle ['r_480' ] < - 50.0 ):
2690
- return True , 'signal_stoploss_u_b_1'
2691
-
2692
- # Under EMA200, pair & BTC negative, CTI, Elder Ray Index negative, normal max rate
2693
- elif (- 0.1 > current_profit > - 0.2 ) & (last_candle ['btc_not_downtrend_1h' ] == False ) & (last_candle ['moderi_32' ] == False ) & (last_candle ['moderi_64' ] == False ) & (last_candle ['moderi_96' ] == False ) & (max_profit < 0.05 ) & (max_loss < 0.2 ) & (last_candle ['sma_200_dec_24' ])& (last_candle ['sma_200_dec_20_1h' ]) & (last_candle ['cmf' ] < - 0.45 ) & (last_candle ['close' ] < last_candle ['ema_200' ]) & (last_candle ['ema_25' ] < last_candle ['ema_50' ]) & (last_candle ['cti' ] < - 0.8 ) & (last_candle ['r_480' ] < - 97.0 ):
2694
- return True , 'signal_stoploss_u_b_2'
2695
-
2696
- elif (self .sell_custom_stoploss_long_profit_min_1 .value < current_profit < self .sell_custom_stoploss_long_profit_max_1 .value ) & (current_profit > (- max_loss + self .sell_custom_stoploss_long_recover_1 .value )) & (last_candle ['cmf' ] < 0.0 ) & (last_candle ['close' ] < last_candle ['ema_200' ]) & (last_candle ['rsi' ] > last_candle ['rsi_1h' ] + self .sell_custom_stoploss_long_rsi_diff_1 .value ) & (last_candle ['sma_200_dec_24' ]) & (current_time - timedelta (minutes = 1200 ) > trade .open_date_utc ):
2697
- return True , 'signal_stoploss_l_r_u_1'
2698
-
2699
- 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 ):
2700
- return True , 'signal_stoploss_l_r_u_2'
2701
-
2702
- 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 )):
2703
- return True , 'signal_stoploss_p_2'
2704
-
2705
- 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 )):
2706
- return True , 'signal_stoploss_p_3'
2684
+ def sell_stoploss (self , current_profit : float , last_candle , previous_candle_1 ) -> tuple :
2685
+ if (- 0.1 < current_profit < - 0.05 ):
2686
+ if (last_candle ['close' ] < last_candle ['atr_high_thresh_1' ]) & (previous_candle_1 ['close' ] > previous_candle_1 ['atr_high_thresh_1' ]):
2687
+ return True , 'signal_stoploss_atr_1'
2688
+ elif (- 0.15 < current_profit < - 0.1 ):
2689
+ if (last_candle ['close' ] < last_candle ['atr_high_thresh_2' ]) & (previous_candle_1 ['close' ] > previous_candle_1 ['atr_high_thresh_2' ]):
2690
+ return True , 'signal_stoploss_atr_2'
2691
+ elif (current_profit < - 0.15 ):
2692
+ if (last_candle ['close' ] < last_candle ['atr_high_thresh_3' ]) & (previous_candle_1 ['close' ] > previous_candle_1 ['atr_high_thresh_3' ]):
2693
+ return True , 'signal_stoploss_atr_3'
2707
2694
2708
2695
return False , None
2709
2696
@@ -2882,11 +2869,11 @@ def sell_quick_mode(self, current_profit: float, max_profit:float, last_candle,
2882
2869
if (0.06 > current_profit > 0.02 ) & (last_candle ['cti' ] > 0.9 ):
2883
2870
return True , 'signal_profit_q_2'
2884
2871
2885
- if (current_profit < - 0.1 ):
2886
- return True , 'signal_stoploss_q_1'
2887
-
2888
- if ( last_candle [ 'close' ] < last_candle [ 'atr_high_thresh' ]) & ( previous_candle_1 [ 'close' ] > previous_candle_1 [ 'atr_high_thresh' ] ):
2889
- return True , 'signal_stoploss_q_atr'
2872
+ if (last_candle [ 'close' ] < last_candle [ 'atr_high_thresh_q' ]) & ( previous_candle_1 [ 'close' ] > previous_candle_1 [ 'atr_high_thresh_q' ] ):
2873
+ if ( current_profit > 0.0 ):
2874
+ return True , 'signal_profit_q_atr'
2875
+ elif ( current_profit < - 0.05 ):
2876
+ return True , 'signal_stoploss_q_atr'
2890
2877
2891
2878
if (current_profit > 0.0 ):
2892
2879
if (last_candle ['pm' ] <= last_candle ['pmax_thresh' ]) & (last_candle ['close' ] > last_candle ['sma_21' ] * 1.1 ):
@@ -2963,7 +2950,7 @@ def custom_sell(self, pair: str, trade: 'Trade', current_time: 'datetime', curre
2963
2950
return signal_name + ' ( ' + buy_tag + ')'
2964
2951
2965
2952
# Stoplosses
2966
- sell , signal_name = self .sell_stoploss (current_profit , last_candle , trade , current_time , max_loss , max_profit )
2953
+ sell , signal_name = self .sell_stoploss (current_profit , last_candle , previous_candle_1 )
2967
2954
if sell and (signal_name is not None ):
2968
2955
return signal_name + ' ( ' + buy_tag + ')'
2969
2956
@@ -3361,7 +3348,10 @@ def normal_tf_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFram
3361
3348
3362
3349
# ATR
3363
3350
dataframe ['atr' ] = ta .ATR (dataframe , timeperiod = 14 )
3364
- dataframe ['atr_high_thresh' ] = (dataframe ['high' ] - (dataframe ['atr' ] * 2.83 ))
3351
+ dataframe ['atr_high_thresh_1' ] = (dataframe ['high' ] - (dataframe ['atr' ] * 3.0 ))
3352
+ dataframe ['atr_high_thresh_2' ] = (dataframe ['high' ] - (dataframe ['atr' ] * 2.2 ))
3353
+ dataframe ['atr_high_thresh_3' ] = (dataframe ['high' ] - (dataframe ['atr' ] * 2.0 ))
3354
+ dataframe ['atr_high_thresh_q' ] = (dataframe ['high' ] - (dataframe ['atr' ] * 2.8 ))
3365
3355
3366
3356
dataframe ['rsi_5' ] = ta .RSI (dataframe , 5 )
3367
3357
dataframe ['streak' ] = calc_streaks (dataframe ["close" ])
0 commit comments