Prevent out of candle ROI sells

This commit is contained in:
Matthias 2021-04-20 20:29:53 +02:00
parent ba6049e4aa
commit cfa9315e2a

View File

@ -239,7 +239,7 @@ class Backtesting:
# Use the maximum between close_rate and low as we # Use the maximum between close_rate and low as we
# cannot sell outside of a candle. # cannot sell outside of a candle.
# Applies when a new ROI setting comes in place and the whole candle is above that. # Applies when a new ROI setting comes in place and the whole candle is above that.
return max(close_rate, sell_row[LOW_IDX]) return min(max(close_rate, sell_row[LOW_IDX]), sell_row[HIGH_IDX])
else: else:
# This should not be reached... # This should not be reached...