fixed side error

This commit is contained in:
adriance 2022-03-15 12:23:59 +08:00
parent 7059892304
commit fd211166f0

View File

@ -392,8 +392,8 @@ class Backtesting:
):
# Worst case: price reaches stop_positive_offset and dives down.
stop_rate = (sell_row[OPEN_IDX] *
(1 + side_1 * abs(self.strategy.trailing_stop_positive_offset) +
abs(self.strategy.trailing_stop_positive / leverage)))
(1 + side_1 * abs(self.strategy.trailing_stop_positive_offset) -
side_1 * abs(self.strategy.trailing_stop_positive / leverage)))
else:
# Worst case: price ticks tiny bit above open and dives down.
stop_rate = sell_row[OPEN_IDX] * (1 -