Fix stop switching to trailing if order is replaced in backtesting
This commit is contained in:
@@ -242,6 +242,7 @@ class Order(ModelBase):
|
|||||||
trade.recalc_trade_from_orders()
|
trade.recalc_trade_from_orders()
|
||||||
if trade.nr_of_successful_entries == 1:
|
if trade.nr_of_successful_entries == 1:
|
||||||
trade.initial_stop_loss_pct = None
|
trade.initial_stop_loss_pct = None
|
||||||
|
trade.is_stop_loss_trailing = False
|
||||||
trade.adjust_stop_loss(trade.open_rate, trade.stop_loss_pct)
|
trade.adjust_stop_loss(trade.open_rate, trade.stop_loss_pct)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -667,7 +668,8 @@ class LocalTrade:
|
|||||||
or (lower_stop and self.is_short)
|
or (lower_stop and self.is_short)
|
||||||
):
|
):
|
||||||
logger.debug(f"{self.pair} - Adjusting stoploss...")
|
logger.debug(f"{self.pair} - Adjusting stoploss...")
|
||||||
self.is_stop_loss_trailing = True
|
if not allow_refresh:
|
||||||
|
self.is_stop_loss_trailing = True
|
||||||
self.__set_stop_loss(stop_loss_norm, stoploss)
|
self.__set_stop_loss(stop_loss_norm, stoploss)
|
||||||
else:
|
else:
|
||||||
logger.debug(f"{self.pair} - Keeping current stoploss...")
|
logger.debug(f"{self.pair} - Keeping current stoploss...")
|
||||||
|
|||||||
Reference in New Issue
Block a user