Fix short bug where close_rate is wrongly adjusted

This commit is contained in:
Matthias 2022-03-16 20:08:36 +01:00
parent c934f939e3
commit d6309449cf

View File

@ -542,6 +542,9 @@ class Backtesting:
proposed_rate=closerate, current_profit=current_profit) proposed_rate=closerate, current_profit=current_profit)
# We can't place orders lower than current low. # We can't place orders lower than current low.
# freqtrade does not support this in live, and the order would fill immediately # freqtrade does not support this in live, and the order would fill immediately
if trade.is_short:
closerate = min(closerate, sell_row[HIGH_IDX])
else:
closerate = max(closerate, sell_row[LOW_IDX]) closerate = max(closerate, sell_row[LOW_IDX])
# Confirm trade exit: # Confirm trade exit:
time_in_force = self.strategy.order_time_in_force['exit'] time_in_force = self.strategy.order_time_in_force['exit']