From 1d652d12840e76377cf1012bf48612dcd045e057 Mon Sep 17 00:00:00 2001 From: Stefano Date: Fri, 31 Oct 2025 08:51:56 +0900 Subject: [PATCH] throw error on recursive analysis on 0 startup candle --- freqtrade/optimize/analysis/recursive.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/freqtrade/optimize/analysis/recursive.py b/freqtrade/optimize/analysis/recursive.py index 7e8e39f5a..9de0ad3ad 100644 --- a/freqtrade/optimize/analysis/recursive.py +++ b/freqtrade/optimize/analysis/recursive.py @@ -8,6 +8,7 @@ from typing import Any from pandas import DataFrame +from freqtrade.exceptions import ConfigurationError from freqtrade.exchange import timeframe_to_minutes from freqtrade.loggers.set_log_levels import ( reduce_verbosity_for_bias_tester, @@ -152,6 +153,13 @@ class RecursiveAnalysis(BaseAnalysis): strat = backtesting.strategy self._strat_scc = strat.startup_candle_count + if self._strat_scc < 1: + raise ConfigurationError( + f"The strategy defines invalid startup candle count of {self._strat_scc}. " + f"This will lead to recursive issues on some indicators. " + f"Please define a proper startup_candle_count in the strategy." + ) + if self._strat_scc not in self._startup_candle: self._startup_candle.append(self._strat_scc) self._startup_candle.sort()