{"record":{"id":"92fae0567bfe4728","repo":"freqtrade/freqtrade","slug":"timeframe-must-be-set-in-either-config-or-via-ti","errorCode":null,"errorMessage":"Timeframe must be set in either config or via --timeframe.","messagePattern":"Timeframe must be set in either config or via --timeframe\\.","errorType":"exception","errorClass":"OperationalException","httpStatus":null,"severity":"error","filePath":"freqtrade/plot/plotting.py","lineNumber":687,"sourceCode":"\n        store_plot_file(\n            fig,\n            filename=generate_plot_filename(pair, config[\"timeframe\"]),\n            directory=config[\"user_data_dir\"] / \"plot\",\n        )\n\n    logger.info(\"End of plotting process. %s plots generated\", pair_counter)\n\n\ndef plot_profit(config: Config) -> None:\n    \"\"\"\n    Plots the total profit for all pairs.\n    Note, the profit calculation isn't realistic.\n    But should be somewhat proportional, and therefore useful\n    in helping out to find a good algorithm.\n    \"\"\"\n    if \"timeframe\" not in config:\n        raise OperationalException(\"Timeframe must be set in either config or via --timeframe.\")\n\n    exchange = ExchangeResolver.load_exchange(config)\n    plot_elements = init_plotscript(config, list(exchange.markets))\n    trades = plot_elements[\"trades\"]\n    # Filter trades to relevant pairs\n    # Remove open pairs - we don't know the profit yet so can't calculate profit for these.\n    # Also, If only one open pair is left, then the profit-generation would fail.\n    trades = trades[\n        (trades[\"pair\"].isin(plot_elements[\"pairs\"])) & (~trades[\"close_date\"].isnull())\n    ]\n    if len(trades) == 0:\n        raise OperationalException(\n            \"No trades found, cannot generate Profit-plot without \"\n            \"trades from either Backtest result or database.\"\n        )\n\n    # Create an average close price of all the pairs that were involved.\n    # this could be useful to gauge the overall market trend","sourceCodeStart":669,"sourceCodeEnd":705,"githubUrl":"https://github.com/freqtrade/freqtrade/blob/1c8edfe4d1e8d11bd4b40e8fc3237c26c3a60e15/freqtrade/plot/plotting.py#L669-L705","documentation":"plot_profit (freqtrade/plot/plotting.py:687) needs the candle timeframe to align trades with OHLCV data when building the cumulative profit plot. Unlike some other commands it does not infer a default, so 'timeframe' must exist in the config (or be provided via --timeframe) before any data is loaded; otherwise it raises OperationalException immediately.","triggerScenarios":"Running `freqtrade plot-profit` with a config that lacks a \"timeframe\" key and without the --timeframe CLI argument.","commonSituations":"Minimal config files reused for plotting; configs where timeframe is supplied by the strategy but not written into config.json; forgetting the CLI flag in scripts/cron jobs.","solutions":["Add --timeframe 5m (matching your data) to the plot-profit command.","Or set \"timeframe\": \"5m\" in the config file used for plotting.","Ensure the timeframe matches the resolution of the downloaded OHLCV data."],"exampleFix":"# before\nfreqtrade plot-profit -c config.json\n\n# after\nfreqtrade plot-profit -c config.json --timeframe 5m\n# or config.json: \"timeframe\": \"5m\"","handlingStrategy":"validation","validationCode":"if \"timeframe\" not in config:\n    config[\"timeframe\"] = \"5m\"  # or fail fast with a clear message\nplot_profit(config)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --timeframe explicitly in plot scripts.","Keep a plotting-specific config that includes timeframe."],"tags":["plotting","configuration","timeframe"],"backgroundTag":null,"analyzedSha":"1c8edfe4d1e8d11bd4b40e8fc3237c26c3a60e15","analyzedAt":"2026-08-15T05:09:08.096Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}