Skip to content

Commit 8857c77

Browse files
authored
Merge pull request freqtrade#12116 from stash86/fix-recursive
move strategy load to after candle_type_def has been defined
2 parents 834aafb + df19c77 commit 8857c77

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

freqtrade/optimize/analysis/recursive.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
)
1616
from freqtrade.optimize.backtesting import Backtesting
1717
from freqtrade.optimize.base_analysis import BaseAnalysis, VarHolder
18-
from freqtrade.resolvers import StrategyResolver
1918

2019

2120
logger = logging.getLogger(__name__)
@@ -33,13 +32,6 @@ def __init__(self, config: dict[str, Any], strategy_obj: dict):
3332

3433
super().__init__(config, strategy_obj)
3534

36-
strat = StrategyResolver.load_strategy(config)
37-
self._strat_scc = strat.startup_candle_count
38-
39-
if self._strat_scc not in self._startup_candle:
40-
self._startup_candle.append(self._strat_scc)
41-
self._startup_candle.sort()
42-
4335
self.partial_varHolder_array: list[VarHolder] = []
4436
self.partial_varHolder_lookahead_array: list[VarHolder] = []
4537

@@ -149,6 +141,13 @@ def prepare_data(self, varholder: VarHolder, pairs_to_load: list[DataFrame]):
149141
self.local_config["candle_type_def"] = prepare_data_config["candle_type_def"]
150142
backtesting._set_strategy(backtesting.strategylist[0])
151143

144+
strat = backtesting.strategy
145+
self._strat_scc = strat.startup_candle_count
146+
147+
if self._strat_scc not in self._startup_candle:
148+
self._startup_candle.append(self._strat_scc)
149+
self._startup_candle.sort()
150+
152151
varholder.data, varholder.timerange = backtesting.load_bt_data()
153152
varholder.timeframe = backtesting.timeframe
154153

freqtrade/optimize/analysis/recursive_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class RecursiveAnalysisSubFunctions:
1717
@staticmethod
1818
def text_table_recursive_analysis_instances(recursive_instances: list[RecursiveAnalysis]):
1919
startups = recursive_instances[0]._startup_candle
20-
strat_scc = recursive_instances[0]._strat_scc
20+
strat_scc = getattr(recursive_instances[0], "_strat_scc", 0) or 0
2121
headers = ["Indicators"]
2222
for candle in startups:
2323
if candle == strat_scc:

0 commit comments

Comments
 (0)