{"record":{"id":"bcbea81fcf3abf6d","repo":"freqtrade/freqtrade","slug":"please-set-a-timerange-usually-a-few-months-are-e","errorCode":null,"errorMessage":"Please set a timerange. Usually a few months are enough depending on your needs and strategy.","messagePattern":"Please set a timerange\\. Usually a few months are enough depending on your needs and strategy\\.","errorType":"validation","errorClass":"OperationalException","httpStatus":null,"severity":"error","filePath":"freqtrade/optimize/analysis/lookahead_helpers.py","lineNumber":186,"sourceCode":"        if config[\"targeted_trade_amount\"] < config[\"minimum_trade_amount\"]:\n            # this combo doesn't make any sense.\n            raise OperationalException(\n                \"Targeted trade amount can't be smaller than minimum trade amount.\"\n            )\n        config[\"max_open_trades\"] = -1\n        logger.info(\"Forced max_open_trades to -1 (same amount as there are pairs)\")\n\n        min_dry_run_wallet = 1000000000\n        if get_dry_run_wallet(config) < min_dry_run_wallet:\n            logger.info(\n                \"Dry run wallet was not set to 1 billion, pushing it up there \"\n                \"just to avoid false positives\"\n            )\n            config[\"dry_run_wallet\"] = min_dry_run_wallet\n\n        if \"timerange\" not in config:\n            # setting a timerange is enforced here\n            raise OperationalException(\n                \"Please set a timerange. \"\n                \"Usually a few months are enough depending on your needs and strategy.\"\n            )\n        # fix stake_amount to 10k.\n        # in a combination with a wallet size of 1 billion it should always be able to trade\n        # no matter if they use custom_stake_amount as a small percentage of wallet size\n        # or fixate custom_stake_amount to a certain value.\n        logger.info(\"fixing stake_amount to 10k\")\n        config[\"stake_amount\"] = 10000\n\n        # enforce cache to be 'none', shift it to 'none' if not already\n        # (since the default value is 'day')\n        if config.get(\"backtest_cache\") is None:\n            config[\"backtest_cache\"] = \"none\"\n        elif config[\"backtest_cache\"] != \"none\":\n            logger.info(\n                f\"backtest_cache = \"\n                f\"{config['backtest_cache']} detected. \"","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/freqtrade/freqtrade/blob/1c8edfe4d1e8d11bd4b40e8fc3237c26c3a60e15/freqtrade/optimize/analysis/lookahead_helpers.py#L168-L204","documentation":"Thrown by LookaheadAnalysisSubFunctions.calculate_config_overrides when the config for a lookahead-analysis run has no 'timerange' key. Lookahead analysis compares backtest results across time segments, which is only meaningful for an explicitly bounded period, so freqtrade refuses to guess one. All other config overrides (max_open_trades=-1, dry_run_wallet=1e9, stake_amount=10000) are applied before/after this check, but a missing timerange aborts the run.","triggerScenarios":"Running `freqtrade lookahead-analysis` without `--timerange 20240101-20240401` and without a `timerange` entry in config.json or strategy config.","commonSituations":"User copies a backtest config that relies on the full downloaded data range; backtest tolerates a missing timerange but lookahead-analysis does not.","solutions":["Add an explicit timerange: `freqtrade lookahead-analysis --timerange 20240101-20240601 --strategy MyStrat`.","Or add \"timerange\": \"20240101-\" to the config file used for the run.","Use a range of at least a few months so enough trades occur for the comparison to be meaningful."],"exampleFix":"# before\nfreqtrade lookahead-analysis --strategy MyStrat\n# after\nfreqtrade lookahead-analysis --strategy MyStrat --timerange 20240101-20240601","handlingStrategy":"validation","validationCode":"def has_timerange(config) -> bool:\n    return \"timerange\" in config and bool(config[\"timerange\"])","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep a dedicated lookahead-analysis config that always includes a timerange entry.","Script wrappers should require a --timerange argument before calling freqtrade lookahead-analysis."],"tags":["freqtrade","lookahead-analysis","timerange","configuration"],"backgroundTag":null,"analyzedSha":"1c8edfe4d1e8d11bd4b40e8fc3237c26c3a60e15","analyzedAt":"2026-08-15T05:09:08.096Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}