From 24de20c6d50e3599f18eb62a5f6bdd80346b8a52 Mon Sep 17 00:00:00 2001 From: topscoder <86197446+topscoder@users.noreply.github.com> Date: Tue, 20 Jul 2021 21:50:35 +0200 Subject: [PATCH 1/3] Fix PR 91 Set actual startup_candle_count only in BACKTEST mode. Probably even in BACKTEST mode it should not be set? Either way, this patch solves the current HO issue with most recent freqtrade-version (develop). --- user_data/strategies/MasterMoniGoManiHyperStrategy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user_data/strategies/MasterMoniGoManiHyperStrategy.py b/user_data/strategies/MasterMoniGoManiHyperStrategy.py index 07d6f199f..00dd93ca6 100644 --- a/user_data/strategies/MasterMoniGoManiHyperStrategy.py +++ b/user_data/strategies/MasterMoniGoManiHyperStrategy.py @@ -350,7 +350,8 @@ def __init__(self, config: dict): if self.timeframe_multiplier < 1: raise SystemExit(f'MoniGoManiHyperStrategy - ERROR - TimeFrame-Zoom - "timeframe" must be bigger than ' f'"backtest_timeframe"') - self.startup_candle_count *= self.timeframe_multiplier + if RunMode(config.get('runmode', RunMode.OTHER)) is RunMode.BACKTEST: + self.startup_candle_count *= self.timeframe_multiplier else: if os.path.isfile(self.mgm_config_hyperopt_path) is False: From 55c9b75e825315a1378f7f7d109139e3d06d073a Mon Sep 17 00:00:00 2001 From: Rikj000 Date: Tue, 20 Jul 2021 20:54:39 +0000 Subject: [PATCH 2/3] :beetle: BugFix incorrect multiplication of startup_candlle_count https://github.com/Rikj000/MoniGoMani/issues/91#issuecomment-883699395 --- user_data/strategies/MasterMoniGoManiHyperStrategy.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/user_data/strategies/MasterMoniGoManiHyperStrategy.py b/user_data/strategies/MasterMoniGoManiHyperStrategy.py index 00dd93ca6..d5bc4ee2d 100644 --- a/user_data/strategies/MasterMoniGoManiHyperStrategy.py +++ b/user_data/strategies/MasterMoniGoManiHyperStrategy.py @@ -344,14 +344,12 @@ def __init__(self, config: dict): f'Auto updated is_dry_live_run_detected to: False') self.mgm_logger('info', initialization, - f'Calculating and storing "timeframe_multiplier" + Updating startup_candle_count"') + f'Calculating and storing "timeframe_multiplier"') self.timeframe_multiplier = \ int(timeframe_to_minutes(self.informative_timeframe) / timeframe_to_minutes(self.timeframe)) if self.timeframe_multiplier < 1: raise SystemExit(f'MoniGoManiHyperStrategy - ERROR - TimeFrame-Zoom - "timeframe" must be bigger than ' f'"backtest_timeframe"') - if RunMode(config.get('runmode', RunMode.OTHER)) is RunMode.BACKTEST: - self.startup_candle_count *= self.timeframe_multiplier else: if os.path.isfile(self.mgm_config_hyperopt_path) is False: From 1bd3e62717a1233b8010a4abbeec5ff52bc51680 Mon Sep 17 00:00:00 2001 From: Rikj000 Date: Sat, 14 Aug 2021 10:05:55 +0000 Subject: [PATCH 3/3] :beetle: BugFix `startup_candlle_count` not being applied to `informative` dataframe --- .../strategies/MasterMoniGoManiHyperStrategy.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/user_data/strategies/MasterMoniGoManiHyperStrategy.py b/user_data/strategies/MasterMoniGoManiHyperStrategy.py index d5bc4ee2d..70e175772 100644 --- a/user_data/strategies/MasterMoniGoManiHyperStrategy.py +++ b/user_data/strategies/MasterMoniGoManiHyperStrategy.py @@ -16,6 +16,7 @@ from pandas import DataFrame from scipy.interpolate import interp1d +from freqtrade.data.history import load_pair_history from freqtrade.enums import RunMode from freqtrade.exchange import timeframe_to_prev_date from freqtrade.misc import deep_merge_dicts, round_dict @@ -343,8 +344,7 @@ def __init__(self, config: dict): self.mgm_logger('info', initialization, f'Current run mode detected as: HyperOpting/BackTesting. ' f'Auto updated is_dry_live_run_detected to: False') - self.mgm_logger('info', initialization, - f'Calculating and storing "timeframe_multiplier"') + self.mgm_logger('info', initialization, f'Calculating and storing "timeframe_multiplier"') self.timeframe_multiplier = \ int(timeframe_to_minutes(self.informative_timeframe) / timeframe_to_minutes(self.timeframe)) if self.timeframe_multiplier < 1: @@ -468,9 +468,13 @@ def _populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFram f'informative_timeframe ({self.informative_timeframe} candles) and ' f'a zoomed backtest_timeframe ({self.backtest_timeframe} candles)') - # Warning! This method gets ALL downloaded data that you have (when in backtesting mode). + # Warning! This method gets ALL downloaded data for the given timeframe (when in BackTesting mode). # If you have many months or years downloaded for this pair, this will take a long time! - informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=self.informative_timeframe) + informative = load_pair_history(pair=metadata['pair'], + datadir=self.config['datadir'], + timeframe=self.informative_timeframe, + startup_candles=self.startup_candle_count, + data_format=self.config.get('dataformat_ohlcv', 'json')) # Throw away older data that isn't needed. first_informative = dataframe['date'].min().floor('H')