Skip to main content

Hyperparameter Optimization

Hyperparameter optimization (hyperopt) automatically finds the best parameter values for your trading strategy. Instead of manually testing different RSI periods, stop-loss levels, or entry thresholds, hyperopt systematically searches through thousands of combinations to find the optimal configuration for your chosen objective — Sharpe ratio, drawdown control, or pure profit.

What Hyperopt Does

Every strategy has parameters that influence its behavior: indicator periods, entry/exit thresholds, stop-loss percentages, ROI targets. Finding the right combination by hand is tedious and often leads to suboptimal results.

Hyperopt solves this by:

  1. Taking your defined parameter ranges (e.g., RSI period: 5–50)
  2. Intelligently sampling combinations across thousands of iterations (epochs)
  3. Evaluating each combination against historical OHLCV data
  4. Converging on the parameter set that best optimizes your chosen loss function

The result is a data-driven parameter configuration rather than a guess — but only if you set it up correctly. Hyperopt is also the easiest way to overfit a strategy to historical noise, so the workflow you use matters more than the search itself.

How Hyperopt Works

  1. Define Parameters — mark strategy parameters for optimization in the Strategy Studio (e.g., RSI period 5–50, entry threshold 10–40)
  2. Configure Search — choose epochs (iterations), optimization spaces, and loss function
  3. Run Optimization — VolatiCloud executes Freqtrade hyperopt on your selected runner
  4. Review Results — examine best parameters, epoch-by-epoch results, and performance metrics

Setting Up Optimizable Parameters

In the Strategy Studio, each numeric parameter (indicator periods, condition thresholds) has an Optimize toggle:

  • Indicator parameters: click the toggle next to Period, Threshold, etc.
  • Condition thresholds: toggle optimization on constant values in entry/exit conditions
  • Min/Max range: define the search bounds for each parameter
  • Space: assign parameters to optimization spaces (Buy Signal, Sell Signal, etc.)
tip

Keep your parameter ranges focused. A wider range means more combinations to test and longer optimization times. Start with a range that makes practical sense for the indicator (e.g., RSI period 5–50 rather than 1–500).

Running a Hyperopt

Step 1: Navigate

Go to the Hyperopt page from the sidebar, or click Run Hyperopt from a strategy's detail page.

Step 2: Select Strategy and Runner

Choose the strategy you want to optimize and the runner that will execute the hyperopt job.

Step 3: Configure Exchange Settings

Select the exchange, trading pair(s), and timeframe. Set the date range for the historical data used during optimization. Reserve the most recent 20–30% of available data as a holdout for out-of-sample validation — do not include it in the hyperopt window.

Step 4: Set Hyperopt Parameters

ParameterDescriptionRecommendation
EpochsNumber of iterations to runStart with 50–100, increase to 500+ for production
Loss FunctionObjective to optimizeSharpe Ratio for balanced results
SpacesWhich parameter groups to optimizeStart with Buy Signal and Sell Signal

Step 5: Run

Click Run Hyperopt. You can monitor progress in real time (see Real-Time Monitoring below).

Run Hyperopt drawer with Strategy and Runner selectors, Exchange and Pairs fields, a Timeframe dropdown, a Time Range section with quick-select chips and custom start/end dates, and an Epochs, Loss Function, and Spaces configuration block

Loss Functions — What Each One Optimizes

The loss function determines what hyperopt is trying to optimize. Each function emphasizes different aspects of strategy performance.

Loss FunctionOptimizes forBest when
Sharpe RatioRisk-adjusted returnsYou want balanced risk/reward (recommended default)
Sortino RatioDownside risk-adjusted returnsYou care more about avoiding losses than capturing gains
Calmar RatioReturns relative to max drawdownDrawdown control is your top priority
Max DrawdownMinimizing maximum drawdownYou need strict capital preservation
Profit/DrawdownBalance between profit and drawdownYou want profit but with drawdown guardrails
Only ProfitMaximum total profitYou're optimizing purely for returns (highest overfitting risk)
warning

Only Profit is the most prone to overfitting. It tends to find parameters that exploit specific historical patterns rather than robust trading signals. Always validate results with an out-of-sample backtest.

Optimization Spaces

Spaces define which groups of parameters hyperopt will search. You can enable one or more:

SpaceWhat it optimizes
Buy SignalEntry condition thresholds and indicator parameters
Sell SignalExit condition thresholds and indicator parameters
ROIReturn-on-investment table (time-based profit targets)
StoplossStop-loss percentage
TrailingTrailing stop-loss parameters
tip

Optimizing all spaces simultaneously increases the search space exponentially. Start with Buy Signal and Sell Signal, then optimize ROI and Stoploss separately with the best signal parameters applied. This staged approach also makes it easier to attribute performance changes to specific parameter groups.

Understanding Results

Overview

After the hyperopt completes, the overview panel shows:

  • Best Epoch — the epoch number that produced the optimal result
  • Best Loss — the objective value achieved (lower is better for most loss functions)
  • Best Parameters — the parameter values from the winning epoch
  • Total Trades — number of trades in the best epoch's backtest
  • Profit — total profit from the best parameter set
  • Max Drawdown — maximum peak-to-trough decline with the best parameters

Epoch Results

The Epochs tab displays a sortable table of all completed epochs:

ColumnDescription
EpochIteration number
LossObjective value (lower is better for most loss functions)
TradesNumber of trades executed
Win RatePercentage of profitable trades
ProfitTotal profit/loss
Max DrawdownMaximum peak-to-trough decline
Sharpe RatioRisk-adjusted performance metric

Sort by any column to find the best-performing parameter sets. The top result (lowest loss) is highlighted automatically.

Applying Results

Once you've identified the best parameters, you can apply them to your strategy directly from the results page. This updates the strategy's parameter values in the Strategy Studio without changing the strategy logic — a new immutable strategy version is created so the previous configuration is preserved.

Real-Time Monitoring

While a hyperopt is running, you can track its progress:

  • Progress bar — shows optimization progress as a percentage, updated approximately every 30 seconds
  • Epoch table — live-updating table that populates as each epoch completes
  • Live logs — stream container logs in real-time to diagnose issues or monitor execution

Best Practices for Crypto Hyperopt

Getting Good Results

  1. Start small, then scale. Run 50–100 epochs first to verify the setup works and parameters are being searched correctly. Then increase to 500+ for a thorough optimization.

  2. Use out-of-sample validation. Split your historical data into two periods. Optimize on the first (in-sample) and validate with a standard backtest on the second (out-of-sample). If out-of-sample performance drops significantly, the parameters are likely overfit. The walk-forward optimization guide formalizes this into a repeatable procedure.

  3. Keep the search space focused. More optimizable parameters does not mean a better strategy. Each additional parameter exponentially increases the search space. Optimize only the parameters that meaningfully affect performance.

  4. Compare loss functions. Run the same hyperopt with different loss functions. If results vary wildly between Sharpe Ratio and Only Profit, the strategy may be fragile.

  5. Check trade count. A parameter set that produces only 5 trades over a year is not statistically meaningful, even if those 5 trades were profitable. Ensure the optimized strategy makes enough trades for confidence (see analyzing backtest results).

Avoiding Overfitting

warning

Overfitting is the biggest risk in hyperparameter optimization. An overfit strategy performs brilliantly on historical data but poorly in live trading.

  • Fewer parameters is better. Every optimizable parameter is a degree of freedom that can latch onto noise rather than signal.
  • Wider date ranges help. Optimize across varied market conditions (trending, ranging, volatile, calm) to find robust parameters.
  • Sanity-check the results. If the optimal RSI period is 47 and the optimal threshold is 31.7, ask whether those values make practical trading sense. Round numbers and conventional ranges are often more robust.
  • Validate with Monte Carlo. After optimizing, run a Monte Carlo simulation on the backtest results to stress-test the parameter set's robustness across thousands of randomized trade orderings.
  • Walk it forward. Walk-forward optimization is the gold standard — train on a rolling window, test only on data the optimizer never saw, and check parameter stability across windows.

The avoiding overfitting in crypto backtests guide covers the full set of techniques.

Plan Requirements

info

Hyperparameter optimization is available on Pro and Enterprise plans.

ProEnterprise
AccessFullFull
Max concurrent hyperopts25
Max epochs per run1,00010,000

Starter plan users can upgrade to Pro to access hyperparameter optimization. See Plans & Pricing for details.

Common Issues

"No hyperopt parameters found"

Ensure you have marked at least one parameter for optimization in the Strategy Studio using the Optimize toggle. Each optimizable parameter needs a defined min/max range.

Long running times

  • Reduce the number of epochs
  • Narrow parameter ranges to shrink the search space
  • Select fewer trading pairs
  • Optimize fewer spaces simultaneously

Poor or inconsistent results

  • Try a different loss function — Sharpe Ratio is the most balanced default
  • Ensure the date range includes enough historical data (at least 6 months recommended)
  • Verify the date range covers varied market conditions, not just a single trend
  • Increase epochs — the optimizer may not have converged with too few iterations

Results don't transfer to live trading

This is typically a sign of overfitting. See Avoiding Overfitting above. The most common remedies are reducing the number of optimized parameters and validating with out-of-sample data via walk-forward optimization.

Next Steps