Risk-adjusted criteria measure how much return a strategy earns per unit of risk. They are essential for comparing strategies that achieve similar raw returns but with very different risk profiles.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ta4j/ta4j/llms.txt
Use this file to discover all available pages before exploring further.
Sharpe ratio
SharpeRatioCriterion
SharpeRatioCriterion
Sortino ratio
SortinoRatioCriterion
SortinoRatioCriterion
Description: Like the Sharpe ratio, but uses only downside deviation (negative excess returns) in the denominator. This avoids penalizing upside volatility.Formula: Interpretation: Same scale as Sharpe. Because it ignores upside volatility, Sortino is generally higher than Sharpe for the same strategy. Returns
Sortino = mean(excessReturn) / downsideDeviationWhere downsideDeviation = sqrt(mean(min(excessReturn, 0)²)).Constructor signatures:NaN when there is no downside deviation (all returns non-negative).Calmar ratio
CalmarRatioCriterion
CalmarRatioCriterion
Description: Compares annualized return (CAGR) against maximum drawdown. Particularly useful for evaluating trend-following strategies where drawdowns can be large but infrequent.Formula: Interpretation: Higher is better. A Calmar ratio of 1.0 means the strategy earns one full maximum drawdown per year. A ratio of 3+ is considered strong. Returns the annualized return directly when maximum drawdown is zero.
Calmar = CAGR / maximumDrawdownConstructor signatures:Omega ratio
OmegaRatioCriterion
OmegaRatioCriterion
Description: Computes the ratio of aggregate upside excess returns to aggregate downside shortfalls relative to a threshold. Unlike Sharpe, Omega uses the entire return distribution, not just mean and variance.Formula:Constructor signatures:Parameters:
Interpretation: Omega > 1 means upside exceeds downside relative to the threshold. At threshold = 0, Omega > 1 is equivalent to a positive expected return. Returns
| Parameter | Description |
|---|---|
threshold | Return threshold in decimal form (e.g., 0.01 for 1%). Defaults to 0. |
NaN when downside shortfall is zero but upside excess exists (theoretically infinite).Return over maximum drawdown (RoMaD)
ReturnOverMaxDrawdownCriterion
ReturnOverMaxDrawdownCriterion
Description: Total net return divided by maximum drawdown. A simpler drawdown-adjusted return metric than Calmar (no annualization).Formula: Interpretation: Higher is better. A value of 5 means the strategy returned 5× its maximum drawdown. This is one of the most commonly used risk-adjusted metrics in systematic trading.
RoMaD = netReturn / maximumDrawdownSystem Quality Number (SQN)
SqnCriterion
SqnCriterion
Description: Van Tharp’s System Quality Number measures the consistency of a trading system by comparing the average trade profit to its standard deviation across trades.Formula: Interpretation:
SQN = (avgPnL / stdev(PnL)) × √(numberOfTrades)Constructor signatures:| SQN | System quality |
|---|---|
| < 1.6 | Poor |
| 1.6 – 1.9 | Below average |
| 2.0 – 2.4 | Average |
| 2.5 – 2.9 | Good |
| 3.0 – 5.0 | Excellent |
| > 5.0 | Holy Grail |
Value at Risk (VaR)
ValueAtRiskCriterion
ValueAtRiskCriterion
Description: The maximum loss not exceeded at a given confidence level over the return distribution. A VaR of Parameters:
Interpretation: VaR is non-positive. Values closer to zero indicate lower tail risk. Higher criterion values are better (
-0.02 at 95% confidence means losses exceed 2% only 5% of the time.Constructor signatures:| Parameter | Description |
|---|---|
confidence | Confidence level as a decimal (e.g., 0.95 for 95%) |
returnRepresentation | How the result is expressed — DECIMAL, PERCENTAGE, LOG, or MULTIPLICATIVE |
betterThan returns true when the first value is greater).Expected Shortfall (CVaR)
ExpectedShortfallCriterion
ExpectedShortfallCriterion
Description: Also known as Conditional Value at Risk (CVaR). Measures the average loss in the tail beyond the VaR threshold — capturing the severity of extreme losses, not just their frequency.Constructor signatures:Interpretation: Like VaR, Expected Shortfall is non-positive. It is always ≤ VaR at the same confidence level (more conservative). Values closer to zero indicate lower average tail loss.
Expected Shortfall is considered a more robust tail-risk measure than VaR because it accounts for the full shape of the loss distribution beyond the threshold.
R-multiple
RMultipleCriterion
RMultipleCriterion
Description: Measures each trade’s profit relative to the initial risk (defined by a Parameters:
Interpretation: R > 1 on average means winners are larger than the initial risk. A system with an average R of 2 earns 2× its risk on each winning trade on average.
PositionRiskModel, typically a stop-loss distance). Average R-multiple across all trades summarizes how well the strategy captures reward relative to its defined risk per trade.Formula: R-multiple = profit / risk per position; averaged across all valid positions.Constructor signature:| Parameter | Description |
|---|---|
riskModel | Provides the per-trade risk amount — e.g., StopLossPositionRiskModel |
Strategy ranking with weighted criteria
UseWeightedCriterion inside BacktestExecutor to rank strategies by a composite score that balances multiple criteria: