Fix missleading variable naming
This commit is contained in:
parent
20f02eb773
commit
9b2ec5e653
@ -961,9 +961,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")
|
||||||
|
|
||||||
sl_lower_long = (trade.stop_loss < (low or current_rate) and not trade.is_short)
|
sl_lower_short = (trade.stop_loss < (low or current_rate) and not trade.is_short)
|
||||||
sl_higher_short = (trade.stop_loss > (high or current_rate) and trade.is_short)
|
sl_higher_long = (trade.stop_loss > (high or current_rate) and trade.is_short)
|
||||||
if self.trailing_stop and (sl_lower_long or sl_higher_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
|
||||||
|
|
||||||
@ -981,12 +981,12 @@ 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_higher_long = (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))
|
sl_lower_short = (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 ((sl_higher_short or sl_lower_long) and
|
if ((sl_higher_long or sl_lower_short) and
|
||||||
(not self.order_types.get('stoploss_on_exchange') or self.config['dry_run'])):
|
(not self.order_types.get('stoploss_on_exchange') or self.config['dry_run'])):
|
||||||
|
|
||||||
sell_type = SellType.STOP_LOSS
|
sell_type = SellType.STOP_LOSS
|
||||||
|
@ -520,7 +520,9 @@ tc28s = BTContainer(data=[
|
|||||||
stop_loss=-0.10, roi={"0": 0.10}, profit_perc=-0.03, trailing_stop=True,
|
stop_loss=-0.10, roi={"0": 0.10}, profit_perc=-0.03, trailing_stop=True,
|
||||||
trailing_only_offset_is_reached=True, trailing_stop_positive_offset=0.05,
|
trailing_only_offset_is_reached=True, trailing_stop_positive_offset=0.05,
|
||||||
trailing_stop_positive=0.03,
|
trailing_stop_positive=0.03,
|
||||||
trades=[BTrade(sell_reason=SellType.TRAILING_STOP_LOSS, open_tick=1, close_tick=3, is_short=True)]
|
trades=[
|
||||||
|
BTrade(sell_reason=SellType.TRAILING_STOP_LOSS, open_tick=1, close_tick=3, is_short=True)
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
# Test 29: trailing_stop should be triggered by low of next candle, without adjusting stoploss using
|
# Test 29: trailing_stop should be triggered by low of next candle, without adjusting stoploss using
|
||||||
|
Loading…
Reference in New Issue
Block a user