isolated conditionals in interface stoploss method
This commit is contained in:
parent
0afd76c183
commit
5fbe76cd7e
@ -840,10 +840,9 @@ class IStrategy(ABC, HyperStrategyMixin):
|
|||||||
else:
|
else:
|
||||||
logger.warning("CustomStoploss function did not return valid stoploss")
|
logger.warning("CustomStoploss function did not return valid stoploss")
|
||||||
|
|
||||||
if self.trailing_stop and (
|
sl_lower_short = (trade.stop_loss < (low or current_rate) and not trade.is_short)
|
||||||
(trade.stop_loss < (low or current_rate) and not trade.is_short) or
|
sl_higher_long = (trade.stop_loss > (high or current_rate) and trade.is_short)
|
||||||
(trade.stop_loss > (high or current_rate) and trade.is_short)
|
if self.trailing_stop and (sl_lower_short or sl_higher_long):
|
||||||
):
|
|
||||||
# trailing stoploss handling
|
# trailing stoploss handling
|
||||||
sl_offset = self.trailing_stop_positive_offset
|
sl_offset = self.trailing_stop_positive_offset
|
||||||
|
|
||||||
@ -867,13 +866,13 @@ class IStrategy(ABC, HyperStrategyMixin):
|
|||||||
|
|
||||||
trade.adjust_stop_loss(bound or current_rate, stop_loss_value)
|
trade.adjust_stop_loss(bound or current_rate, stop_loss_value)
|
||||||
|
|
||||||
|
sl_higher_short = (trade.stop_loss >= (low or current_rate) and not trade.is_short)
|
||||||
|
sl_lower_long = ((trade.stop_loss <= (high or current_rate) and trade.is_short))
|
||||||
# evaluate if the stoploss was hit if stoploss is not on exchange
|
# evaluate if the stoploss was hit if stoploss is not on exchange
|
||||||
# in Dry-Run, this handles stoploss logic as well, as the logic will not be different to
|
# in Dry-Run, this handles stoploss logic as well, as the logic will not be different to
|
||||||
# regular stoploss handling.
|
# regular stoploss handling.
|
||||||
if ((
|
if ((sl_higher_short or sl_lower_long) and
|
||||||
(trade.stop_loss >= (low or current_rate) and not trade.is_short) or
|
(not self.order_types.get('stoploss_on_exchange') or self.config['dry_run'])):
|
||||||
((trade.stop_loss <= (high or current_rate) and trade.is_short))
|
|
||||||
) and (not self.order_types.get('stoploss_on_exchange') or self.config['dry_run'])):
|
|
||||||
|
|
||||||
sell_type = SellType.STOP_LOSS
|
sell_type = SellType.STOP_LOSS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user