mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-12 19:23:55 +00:00
Improve logic for initially placed stoploss
This commit is contained in:
parent
2b0e281113
commit
c15e10fe1f
|
@ -1170,15 +1170,13 @@ class FreqtradeBot(LoggingMixin):
|
||||||
|
|
||||||
# If enter order is fulfilled but there is no stoploss, we add a stoploss on exchange
|
# If enter order is fulfilled but there is no stoploss, we add a stoploss on exchange
|
||||||
if not stoploss_order:
|
if not stoploss_order:
|
||||||
stoploss = (
|
stop_price = trade.stoploss_or_liquidation
|
||||||
self.edge.stoploss(pair=trade.pair)
|
if self.edge:
|
||||||
if self.edge else
|
stoploss = self.edge.stoploss(pair=trade.pair)
|
||||||
trade.stop_loss_pct / trade.leverage
|
stop_price = (
|
||||||
)
|
trade.open_rate * (1 - stoploss) if trade.is_short
|
||||||
if trade.is_short:
|
else trade.open_rate * (1 + stoploss)
|
||||||
stop_price = trade.open_rate * (1 - stoploss)
|
)
|
||||||
else:
|
|
||||||
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.
|
# The above will return False if the placement failed and the trade was force-sold.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user