parent
9ff52c0a93
commit
24f480b4ce
@ -873,11 +873,15 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
stop_price = trade.open_rate * (1 + stoploss)
|
stop_price = trade.open_rate * (1 + stoploss)
|
||||||
|
|
||||||
if self.create_stoploss_order(trade=trade, stop_price=stop_price):
|
if self.create_stoploss_order(trade=trade, stop_price=stop_price):
|
||||||
|
# The above will return False if the placement failed and the trade was force-sold.
|
||||||
|
# in which case the trade will be closed - which we must check below.
|
||||||
trade.stoploss_last_update = datetime.utcnow()
|
trade.stoploss_last_update = datetime.utcnow()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# If stoploss order is canceled for some reason we add it
|
# If stoploss order is canceled for some reason we add it
|
||||||
if stoploss_order and stoploss_order['status'] in ('canceled', 'cancelled'):
|
if (trade.is_open
|
||||||
|
and stoploss_order
|
||||||
|
and stoploss_order['status'] in ('canceled', 'cancelled')):
|
||||||
if self.create_stoploss_order(trade=trade, stop_price=trade.stop_loss):
|
if self.create_stoploss_order(trade=trade, stop_price=trade.stop_loss):
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
@ -887,7 +891,7 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
# Finally we check if stoploss on exchange should be moved up because of trailing.
|
# Finally we check if stoploss on exchange should be moved up because of trailing.
|
||||||
# Triggered Orders are now real orders - so don't replace stoploss anymore
|
# Triggered Orders are now real orders - so don't replace stoploss anymore
|
||||||
if (
|
if (
|
||||||
stoploss_order
|
trade.is_open and stoploss_order
|
||||||
and stoploss_order.get('status_stop') != 'triggered'
|
and stoploss_order.get('status_stop') != 'triggered'
|
||||||
and (self.config.get('trailing_stop', False)
|
and (self.config.get('trailing_stop', False)
|
||||||
or self.config.get('use_custom_stoploss', False))
|
or self.config.get('use_custom_stoploss', False))
|
||||||
|
Loading…
Reference in New Issue
Block a user