Update stoploss handling for entry-order adjustment
This commit is contained in:
@@ -780,8 +780,6 @@ class Backtesting:
|
||||
# interest_rate=interest_rate,
|
||||
orders=[],
|
||||
)
|
||||
elif trade.nr_of_successful_entries == 0:
|
||||
trade.open_rate = propose_rate
|
||||
|
||||
trade.adjust_stop_loss(trade.open_rate, self.strategy.stoploss, initial=True)
|
||||
|
||||
@@ -814,11 +812,11 @@ class Backtesting:
|
||||
remaining=amount,
|
||||
cost=stake_amount + trade.fee_open,
|
||||
)
|
||||
trade.orders.append(order)
|
||||
if pos_adjust and self._get_order_filled(order.price, row):
|
||||
order.close_bt_order(current_time, trade)
|
||||
else:
|
||||
trade.open_order_id = str(self.order_id_counter)
|
||||
trade.orders.append(order)
|
||||
trade.recalc_trade_from_orders()
|
||||
|
||||
return trade
|
||||
@@ -942,8 +940,6 @@ class Backtesting:
|
||||
requested_rate=requested_rate,
|
||||
requested_stake=(order.remaining * order.price),
|
||||
direction='short' if trade.is_short else 'long')
|
||||
trade.adjust_stop_loss(trade.open_rate, self.strategy.stoploss,
|
||||
initial=False, refresh=True)
|
||||
else:
|
||||
# assumption: there can't be multiple open entry orders at any given time
|
||||
return (trade.nr_of_successful_entries == 0)
|
||||
|
Reference in New Issue
Block a user