Optimization
/HERC Optimization
HERC Optimization
An advanced portfolio optimization method that groups assets into natural clusters and balances risk contribution equally across those groups — so no single cluster can drag your portfolio down.
Hierarchical Equal Risk Contribution (HERC) is an advanced portfolio optimization method that extends HRP Optimization. Like HRP, it uses hierarchical clustering to group your assets into natural clusters based on how their returns move together — for example, aggressive growth stocks, defensive assets, commodities, and bonds.
The key difference from HRP is in how risk is allocated across those clusters:
- HRP weights clusters inversely proportional to their risk (higher risk = lower weight). This can lead to overly conservative allocations in riskier-but-valuable clusters.
- HERC adjusts weights so each cluster contributes equally to total portfolio risk. This produces a more balanced distribution across distinct asset groups.
The result is a portfolio where no single group dominates the risk — even if that group is made up of low-volatility assets.
Optimization Settings
Risk Measure
Defines how risk is quantified at both the asset level and the cluster level. HERC uses this measure to determine how much each cluster — and each asset within it — should be weighted to achieve equal risk contribution.
Volatility-Based:
Standard Deviation
The most common starting point. Measures how much returns deviate from their average. Each cluster is weighted so its contribution to portfolio standard deviation equals all other clusters.
Mean Absolute Deviation (Pro)
The average absolute deviation from the mean. Less sensitive to large outliers. Useful for portfolios where extreme individual events are more common.
Downside Risk:
Semi Standard Deviation (Pro)
Only measures negative return deviations — ignores upside volatility. Useful for investors who care about loss protection more than reducing overall variability.
Sortino Ratio (Pro)
Weights clusters to equalize downside-adjusted return contributions. Clusters that produce more return per unit of downside risk receive more weight.
Omega Ratio (Pro)
Evaluates the full return distribution. Compares probability-weighted gains above a threshold to probability-weighted losses below it. Robust when returns are not normally distributed.
Drawdown-Based:
Maximum Drawdown
The largest peak-to-trough decline. Clusters containing assets with historically deep drawdowns receive lower weights.
Conditional Drawdown at Risk (CDaR) (Pro)
The average drawdown in the worst scenarios beyond a given probability. Captures both how often and how severely a cluster experiences large declines — more comprehensive than Maximum Drawdown alone.
Ulcer Index (Pro)
Accounts for both the depth and duration of drawdowns. A cluster that spends a long time underwater scores higher, making this measure particularly useful for investors sensitive to prolonged periods of loss.
Tail Risk:
Value at Risk (VaR) (Pro)
The maximum expected loss at a given confidence level. Sets a boundary for normal worst-case outcomes but does not describe losses beyond that boundary.
Conditional Value at Risk (CVaR) (Pro)
Also known as Expected Shortfall. The average loss in the worst scenarios beyond the VaR threshold. Recommended for tail-risk-focused allocation — captures the impact of extreme events more completely than VaR.
HERC and Tail Risk Measures
HERC is particularly well-suited for tail risk measures like CVaR and CDaR. When you want to ensure that no single cluster dominates the risk of extreme losses, CVaR provides a more meaningful optimization target than standard deviation.
Risk Free Rate
The minimum return expected without taking any risk. Used in risk-adjusted metric calculations for the results comparison. Pre-filled with a commonly used reference rate.
Reoptimize Frequency
Once
Builds the cluster hierarchy and calculates equal-risk weights using all available data up to the Optimization Date. A single set of weights is produced.
Quarterly (Pro)
Re-clusters and re-weights at the end of each quarter using only data available up to that point. Simulates how the strategy would perform if deployed in real-time.
Yearly (Pro)
Re-clusters and re-weights once per year. Lower turnover — suitable for long-term investors.
Optimization Date
Splits history into a training period (before the date) and an out-of-sample test period (after the date). Clustering and weight calculation use only the training period data. Performance after the date is unseen and reflects real predictive accuracy.
Preset options: 1Y, 2Y, 3Y, 5Y ago, or a custom date.
Training Window
How much historical data is used to estimate correlations and build the cluster hierarchy.
- 1 Year — reactive, captures recent dynamics, statistically less stable
- 3 Years — balanced default for most use cases
- 5+ Years — stable estimates, may miss recent structural shifts
HERC is more computationally intensive than HRP at each node of the hierarchy, so a longer, stable training window is generally beneficial.
Correlated Assets
When set to Drop, assets with correlation above 0.95 are automatically removed before optimization. This prevents near-duplicate assets from artificially splitting into the same cluster and distorting the equal-risk allocation.
Constraints
Min. Position Weight
Minimum allocation any single asset can receive. Default is 0%.
Max. Position Weight
Maximum allocation any single asset can receive. Default is 100%.
Individual Asset Limits
Per-symbol overrides for specific tickers. Expand to configure per-asset constraints.
Freeze
Lock a specific asset's allocation. The optimizer will not adjust that position while rebalancing the rest.
Benchmark
An optional market index (e.g., SPY) shown in the performance charts for comparison.
Results
Asset Clusters
HERC's hierarchical clustering step groups assets by how similarly their returns move. The Optimal Asset Allocation section shows:
- The recommended weight for each asset
- The Asset Clusters detected by the algorithm
In HERC, each cluster receives an equal share of the total portfolio risk, and within each cluster, assets are weighted by their individual risk contributions. This two-level balancing is what distinguishes HERC from standard Risk Parity (which operates only at the individual asset level) and HRP (which weights inversely to cluster risk rather than equalizing it).
Key Improvements
Side-by-side comparison of original vs optimized across: Return (1Y), Volatility (1Y), Sharpe Ratio (1Y), Sortino Ratio (1Y), Calmar Ratio, Max Drawdown, and Worst Day. Improvements are highlighted in green.
Performance and Risk Charts
Full historical charts: Portfolio Performance, Allocation Over Time, Sharpe Ratio, Drawdowns, Volatility, and Correlation Matrix.
HERC vs HRP
Allocation philosophy
HRP weights clusters inversely proportional to their risk — riskier clusters get less weight. HERC equalizes risk contribution across all clusters — each group contributes the same share of total risk regardless of its individual risk level.
Result
HERC typically produces more balanced risk distribution across distinct asset groups. HRP can be more conservative, potentially under-allocating to riskier-but-valuable asset classes.
Computational intensity
HERC requires an optimization step at each node of the hierarchy, making it more computationally intensive than HRP. It also benefits more from having a stable, longer training window.
Asset count
HERC works best with 15+ assets that form natural, distinct clusters. With fewer assets, the clustering step produces less differentiated groups and the advantage over HRP diminishes.
When to Use HERC
Your portfolio has distinct asset groups
HERC adds the most value when your holdings span genuinely different categories — e.g., tech stocks, bonds, commodities, cash equivalents. With homogeneous assets, clustering adds limited benefit.
You want equal risk at the cluster level
If you want every category in your portfolio to carry the same risk weight, HERC is the right tool. HRP and Risk Parity operate at different levels of granularity.
You are optimizing for tail risk
HERC pairs particularly well with CVaR and CDaR risk measures. This combination ensures no single cluster dominates the probability of extreme losses.
You want to prevent any single group from dominating
HERC's equal-risk-at-cluster-level design explicitly prevents concentration — even in clusters that happen to contain many low-volatility assets.
Suggested Next Steps
Compare HERC and HRP side by side
Run the same portfolio through both methods with Standard Deviation as the risk measure. Compare the resulting allocations and Key Improvements to see how equalizing cluster risk changes the outcome.
Try tail risk measures
Switch to CVaR or CDaR as the risk measure to see how HERC reallocates when optimization focuses on preventing extreme cluster-level losses rather than reducing volatility.
Review the asset clusters
After running HERC, examine which assets were grouped together. The clusters reveal how the algorithm views the structural relationships in your portfolio — which can inform decisions about adding or removing assets.