From 07b7828f39a28877ed05e866e3ba737e94d560b8 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste LE STANG Date: Wed, 31 Jan 2018 07:59:45 +0100 Subject: [PATCH] Fixing bug in backtesting causing to much sells --- freqtrade/optimize/backtesting.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index e8fcec875..814ab9cfb 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -84,7 +84,9 @@ def get_sell_trade_entry(pair, row, buy_subset, ticker, trade_count_lock, args): # Increase trade_count_lock for every iteration trade_count_lock[row2.date] = trade_count_lock.get(row2.date, 0) + 1 - buy_signal = buy_subset[buy_subset.date == row2.date].empty + # Buy is on is in the buy_subset there is a row that matches the date + # of the sell event + buy_signal = not buy_subset[buy_subset.date == row2.date].empty if(should_sell(trade, row2.close, row2.date, buy_signal, row2.sell)): return row2, (pair, trade.calc_profit_percent(rate=row2.close),