diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 3dd643561..57282aae9 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -162,6 +162,10 @@ class Backtesting(object): pair_data['buy'], pair_data['sell'] = 0, 0 # cleanup from previous run ticker_data = self.populate_sell_trend(self.populate_buy_trend(pair_data))[headers] + + # to avoid using data from future, we buy/sell with signal from previous candle, not current + ticker_data.buy = ticker_data.buy.shift(1) + ticker_data.sell = ticker_data.sell.shift(1) ticker = [x for x in ticker_data.itertuples()] lock_pair_until = None