From 68b75af08e654e226c0993124875b85f3ca98336 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 5 Sep 2021 08:59:18 +0200 Subject: [PATCH] Fix bug with inversed sell signals in backtesting --- freqtrade/optimize/backtesting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index ad6bdbf18..cf670f87d 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -365,8 +365,8 @@ class Backtesting: def _get_sell_trade_entry_for_candle(self, trade: LocalTrade, sell_row: Tuple) -> Optional[LocalTrade]: sell_candle_time = sell_row[DATE_IDX].to_pydatetime() - enter = sell_row[LONG_IDX] if trade.is_short else sell_row[SHORT_IDX] - exit_ = sell_row[ELONG_IDX] if trade.is_short else sell_row[ESHORT_IDX] + enter = sell_row[SHORT_IDX] if trade.is_short else sell_row[LONG_IDX] + exit_ = sell_row[ESHORT_IDX] if trade.is_short else sell_row[ELONG_IDX] sell = self.strategy.should_exit( trade, sell_row[OPEN_IDX], sell_candle_time, # type: ignore enter=enter, exit_=exit_,