From 79985fda015c0f060d0b0aca7d83962c43c75e8e Mon Sep 17 00:00:00 2001 From: Wagner Costa Santos Date: Sat, 10 Sep 2022 10:27:17 -0300 Subject: [PATCH] fix backtesting freqai startup candles bug --- freqtrade/freqai/data_kitchen.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/freqtrade/freqai/data_kitchen.py b/freqtrade/freqai/data_kitchen.py index 01b2f1f3b..88d841b9e 100644 --- a/freqtrade/freqai/data_kitchen.py +++ b/freqtrade/freqai/data_kitchen.py @@ -468,8 +468,14 @@ class FreqaiDataKitchen: Function which takes the backtesting time range and remove training data from dataframe """ + startup_candle_count = self.config.get('startup_candle_count', 0) + tf = self.config['timeframe'] tr = self.config["timerange"] + backtesting_timerange = TimeRange.parse_timerange(tr) + if startup_candle_count > 0 and backtesting_timerange: + backtesting_timerange.subtract_start(timeframe_to_seconds(tf) * startup_candle_count) + start = datetime.fromtimestamp(backtesting_timerange.startts, tz=timezone.utc) df = self.return_dataframe df = df.loc[df["date"] >= start, :]