freqtrade/freqtrade · error · OperationalException
Timeframe must be set in either config or via --timeframe.
Error message
Timeframe must be set in either config or via --timeframe.
What it means
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.
Source
Thrown at freqtrade/plot/plotting.py:687
store_plot_file(
fig,
filename=generate_plot_filename(pair, config["timeframe"]),
directory=config["user_data_dir"] / "plot",
)
logger.info("End of plotting process. %s plots generated", pair_counter)
def plot_profit(config: Config) -> None:
"""
Plots the total profit for all pairs.
Note, the profit calculation isn't realistic.
But should be somewhat proportional, and therefore useful
in helping out to find a good algorithm.
"""
if "timeframe" not in config:
raise OperationalException("Timeframe must be set in either config or via --timeframe.")
exchange = ExchangeResolver.load_exchange(config)
plot_elements = init_plotscript(config, list(exchange.markets))
trades = plot_elements["trades"]
# Filter trades to relevant pairs
# Remove open pairs - we don't know the profit yet so can't calculate profit for these.
# Also, If only one open pair is left, then the profit-generation would fail.
trades = trades[
(trades["pair"].isin(plot_elements["pairs"])) & (~trades["close_date"].isnull())
]
if len(trades) == 0:
raise OperationalException(
"No trades found, cannot generate Profit-plot without "
"trades from either Backtest result or database."
)
# Create an average close price of all the pairs that were involved.
# this could be useful to gauge the overall market trendView on GitHub (pinned to 1c8edfe4d1)
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.
Example fix
# before freqtrade plot-profit -c config.json # after freqtrade plot-profit -c config.json --timeframe 5m # or config.json: "timeframe": "5m"
Defensive patterns
Strategy: validation
Validate before calling
if "timeframe" not in config:
config["timeframe"] = "5m" # or fail fast with a clear message
plot_profit(config) Prevention
- Always pass --timeframe explicitly in plot scripts.
- Keep a plotting-specific config that includes timeframe.
When it happens
Trigger: Running `freqtrade plot-profit` with a config that lacks a "timeframe" key and without the --timeframe CLI argument.
Common situations: 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.
Related errors
- Invalid timeframe '{timeframe}'. This exchange supports: {se
- Timeframes < 1m are currently not supported by Freqtrade.
- Timeframe needs to be set in either configuration or as cli
- Detail timeframe must be smaller than strategy timeframe.
- No data found. Please make sure that data is available for t
AI-assisted analysis of freqtrade/freqtrade@1c8edfe4d1 (2026-08-15).
Data as JSON: /api/errors/92fae0567bfe4728.
Report an issue: GitHub.