Improve formatting to avoid backslash newlines

This commit is contained in:
Matthias 2021-07-03 08:22:21 +02:00
parent bc0742ae67
commit fbd91cd3f8

View File

@ -229,10 +229,12 @@ class Backtesting:
# pessimistic price movement, which is moving just enough to arm stoploss and # pessimistic price movement, which is moving just enough to arm stoploss and
# immediately going down to stop price. # immediately going down to stop price.
if sell.sell_type == SellType.TRAILING_STOP_LOSS and trade_dur == 0: if sell.sell_type == SellType.TRAILING_STOP_LOSS and trade_dur == 0:
if not self.strategy.use_custom_stoploss and self.strategy.trailing_stop and \ if (
self.strategy.trailing_only_offset_is_reached and \ not self.strategy.use_custom_stoploss and self.strategy.trailing_stop
self.strategy.trailing_stop_positive_offset is not None and \ and self.strategy.trailing_only_offset_is_reached
self.strategy.trailing_stop_positive: and self.strategy.trailing_stop_positive_offset is not None
and self.strategy.trailing_stop_positive
):
# Worst case: price reaches stop_positive_offset and dives down. # Worst case: price reaches stop_positive_offset and dives down.
stop_rate = (sell_row[OPEN_IDX] * stop_rate = (sell_row[OPEN_IDX] *
(1 + abs(self.strategy.trailing_stop_positive_offset) - (1 + abs(self.strategy.trailing_stop_positive_offset) -