Merge pull request #2342 from freqtrade/fix/negativeroi

Don't have backtest sells outside of a candle
This commit is contained in:
hroff-1902
2019-10-08 11:19:34 +03:00
committed by GitHub
4 changed files with 45 additions and 24 deletions

View File

@@ -270,6 +270,11 @@ class Backtesting:
# - (Expected abs profit + open_rate + open_fee) / (fee_close -1)
closerate = - (trade.open_rate * roi + trade.open_rate *
(1 + trade.fee_open)) / (trade.fee_close - 1)
# Use the maximum between closerate and low as we
# cannot sell outside of a candle.
# Applies when using {"xx": -1} as roi to force sells after xx minutes
closerate = max(closerate, sell_row.low)
else:
# This should not be reached...
closerate = sell_row.open