Skip to content
All library documents

Using Hyperparameter Optimization to Tune Trading Strategies

Article Freqtrade docs

Summary

The document explains how Freqtrade’s Hyperopt process searches strategy parameter combinations by repeatedly backtesting historical data. It begins with random combinations and then uses an Optuna sampler to explore parameter spaces while minimizing a selected loss function. Users choose which parameter spaces to optimize, set run limits and worker counts, and can select among loss functions that emphasize measures such as profit, Sharpe ratio, Sortino ratio, or drawdown. The chosen loss function can materially change which parameters are preferred.

The guide notes that the process is computationally intensive and depends on suitable historical data. Strategy indicators needed across optimization spaces must be populated, and parameter calculations that should vary per epoch must be placed in the appropriate strategy method. After optimization, results should be checked with a backtest using matching settings. Differences can arise from configuration overrides, parameter export or import mistakes, or mismatched protections. The document describes tooling and validation practices, but supplies no evidence that optimized parameters will perform well out of sample or in live trading.

Key ideas

  • Hyperopt evaluates many parameter combinations by repeating backtests on historical data.
  • The sampler searches configured parameter spaces to minimize a chosen loss function.
  • Different loss functions reward different outcomes and can produce different parameter choices.
  • Indicator calculations and parameter placement affect whether each epoch tests the intended settings.
  • Compare optimized results with a backtest using the same data range and configuration.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.