OPEN-SOURCE SCRIPT
Adaptive Sharpe Ratio (Robust & Regime-Aware)

Adaptive Sharpe Ratio (Robust & Regime-Aware) — ASR+
ASR+ (Adaptive Sharpe Ratio) on a daily chart, highlighting regime shifts and dynamically adjusted risk-aware performance.
WHAT IS ASR+
ASR+ (Adaptive Sharpe Ratio) is an enhanced version of the traditional Sharpe Ratio designed to remain statistically reliable in real market conditions.
It improves on the standard model by correcting for autocorrelation, fat tails, and regime-dependent volatility—factors that routinely distort conventional Sharpe readings.
The result is a more stable, realistic measure of risk-adjusted performance that adapts across timeframes, asset classes, and market environments.
WHY THIS MATTERS
The standard Sharpe Ratio assumes:
Stable volatility
Independent returns
Normally distributed returns
Real markets violate all of these assumptions.
Result: Sharpe can become inflated, unstable, and misleading—often underestimating risk, especially on lower timeframes.
ASR+ is designed to overcome these shortcomings.
WHAT “ROBUST” MEANS
ASR+ is built to resist common distortions:
Outliers & fat tails → adjusted
Skewed returns → penalized
Autocorrelation → corrected (HAC / Newey–West)
Small samples → estimation bias reduced
Result: more stable and realistic Sharpe values.
WHAT “REGIME-AWARE” MEANS
Markets change — volatility and behavior shift.
ASR+ adapts dynamically:
High volatility → stronger risk penalty
Calm markets → normalized evaluation
Regime shifts → reflected in real time
Result: avoids false confidence during risky conditions.
─────────────────────────────────────────
WHAT MAKES ASR+ DIFFERENT
─────────────────────────────────────────
🔹 HAC Autocorrelation Correction (Newey-West)
Uses a 4-lag Bartlett kernel to correct for serial correlation in returns. When returns are trending or mean-reverting, standard volatility estimates are biased. ASR+ adjusts variance to prevent Sharpe inflation during momentum regimes.
🔹 Cornish-Fisher Tail Adjustment
Incorporates skewness and excess kurtosis into the risk estimate. Markets with fat tails or negative skew carry more downside risk than standard deviation alone captures. This adjustment penalizes asymmetric or heavy-tailed return distributions at the 95% confidence level.
🔹 Volatility Regime Penalty
Detects when current volatility is elevated relative to its historical average and applies a dynamic penalty. ASR+ becomes more conservative exactly when standard Sharpe is most likely to mislead.
🔹 Small-Sample Uncertainty Correction
Applies a bias correction to the mean return estimate, accounting for statistical uncertainty from limited observations. Shorter lookbacks carry more estimation error, which ASR+ reflects.
🔹 Adaptive Risk Adjustment
All adjustments — tail risk, volatility regime, autocorrelation, and estimation uncertainty — are combined through an interaction-aware framework. This prevents double-counting while allowing interacting risk factors to generate appropriately compounded penalties. The total adjustment is capped to avoid over-penalization.
🔹 Multi-Asset, Multi-Timeframe Scaling
Automatically detects asset type (crypto, equities, forex, futures) and timeframe (seconds through monthly) and applies appropriate annualization.
Crypto → 365-day, 24-hour markets
Equities → 252-day, 6.5-hour sessions
No manual configuration required.
🔹 Extreme Value Moderation
During periods of high volatility or reduced estimation reliability, ASR+ moderates extreme Sharpe values in both directions. Positive readings may be reduced, while negative readings may move closer to zero, reflecting lower statistical confidence rather than a change in underlying performance.
🔹 Logarithmic Returns
ASR+ uses logarithmic (log) returns instead of arithmetic returns. Log returns are time-additive and more statistically consistent across timeframes, improving the stability and comparability of risk-adjusted performance, particularly over longer horizons and in the presence of compounding.
ADAPTIVE VS STANDARD SHARPE
Toggle between:
Standard Sharpe → baseline calculation (thinner line)
ASR+ → adjusted, real-world version (thicker line)
Use this to:
Detect inflated Sharpe values
Reveal hidden risk
Validate strategy robustness
─────────────────────────────────────────
REGIME CLASSIFICATION
─────────────────────────────────────────
Light theme view for clarity and accessibility. The same regime classification logic is applied across themes.
ASR+ colors both the plotted line and background for instant interpretation:
🔴 Red → Below 0 — Negative risk-adjusted return
⚫ Gray → 0 to 1 — Subpar performance
🟢 Green → 1 to 2 — Good performance
💚 Lime → Above 2 — Exceptional performance
─────────────────────────────────────────
KEY INPUTS & SETTINGS
─────────────────────────────────────────
→ Lookback Period
Minimum: 50 bars (Daily & Intraday), 36 (Weekly), 24 (Monthly)
Recommended: 63 (Daily), 100 (4H), 252 (1H), 500 (30M)
For high-volatility assets (e.g., growth stocks, crypto), longer lookbacks are recommended to reduce sensitivity to short-term trends
Short lookbacks during strong trending conditions can produce elevated readings that reflect momentum rather than sustainable risk-adjusted performance
→ Risk-Free Rate
Annualized (default 4.5%), adjustable to reflect prevailing rates
→ Show Adaptive vs Standard Sharpe
Plot both to visualize adjustment magnitude
→ EMA Smoother
Optional smoothing to reduce noise
→ Background Regime Colors
Fully customizable
─────────────────────────────────────────
WHO THIS IS FOR
─────────────────────────────────────────
→ Quantitative traders evaluating strategies
→ Multi-asset traders needing consistent metrics
→ Risk-conscious traders focused on efficiency, not just returns
→ Systematic traders monitoring regime shifts in real time
IMPORTANT
ASR+ is not a buy/sell signal.
It measures the quality of returns to support:
Strategy evaluation
Risk control
Position sizing
All calculations are based on confirmed historical data and do not rely on future values.
─────────────────────────────────────────
Built with statistical rigor for traders who demand more accurate evaluation tools.
─────────────────────────────────────────
ASR+ (Adaptive Sharpe Ratio) on a daily chart, highlighting regime shifts and dynamically adjusted risk-aware performance.
WHAT IS ASR+
ASR+ (Adaptive Sharpe Ratio) is an enhanced version of the traditional Sharpe Ratio designed to remain statistically reliable in real market conditions.
It improves on the standard model by correcting for autocorrelation, fat tails, and regime-dependent volatility—factors that routinely distort conventional Sharpe readings.
The result is a more stable, realistic measure of risk-adjusted performance that adapts across timeframes, asset classes, and market environments.
WHY THIS MATTERS
The standard Sharpe Ratio assumes:
Stable volatility
Independent returns
Normally distributed returns
Real markets violate all of these assumptions.
Result: Sharpe can become inflated, unstable, and misleading—often underestimating risk, especially on lower timeframes.
ASR+ is designed to overcome these shortcomings.
WHAT “ROBUST” MEANS
ASR+ is built to resist common distortions:
Outliers & fat tails → adjusted
Skewed returns → penalized
Autocorrelation → corrected (HAC / Newey–West)
Small samples → estimation bias reduced
Result: more stable and realistic Sharpe values.
WHAT “REGIME-AWARE” MEANS
Markets change — volatility and behavior shift.
ASR+ adapts dynamically:
High volatility → stronger risk penalty
Calm markets → normalized evaluation
Regime shifts → reflected in real time
Result: avoids false confidence during risky conditions.
─────────────────────────────────────────
WHAT MAKES ASR+ DIFFERENT
─────────────────────────────────────────
🔹 HAC Autocorrelation Correction (Newey-West)
Uses a 4-lag Bartlett kernel to correct for serial correlation in returns. When returns are trending or mean-reverting, standard volatility estimates are biased. ASR+ adjusts variance to prevent Sharpe inflation during momentum regimes.
🔹 Cornish-Fisher Tail Adjustment
Incorporates skewness and excess kurtosis into the risk estimate. Markets with fat tails or negative skew carry more downside risk than standard deviation alone captures. This adjustment penalizes asymmetric or heavy-tailed return distributions at the 95% confidence level.
🔹 Volatility Regime Penalty
Detects when current volatility is elevated relative to its historical average and applies a dynamic penalty. ASR+ becomes more conservative exactly when standard Sharpe is most likely to mislead.
🔹 Small-Sample Uncertainty Correction
Applies a bias correction to the mean return estimate, accounting for statistical uncertainty from limited observations. Shorter lookbacks carry more estimation error, which ASR+ reflects.
🔹 Adaptive Risk Adjustment
All adjustments — tail risk, volatility regime, autocorrelation, and estimation uncertainty — are combined through an interaction-aware framework. This prevents double-counting while allowing interacting risk factors to generate appropriately compounded penalties. The total adjustment is capped to avoid over-penalization.
🔹 Multi-Asset, Multi-Timeframe Scaling
Automatically detects asset type (crypto, equities, forex, futures) and timeframe (seconds through monthly) and applies appropriate annualization.
Crypto → 365-day, 24-hour markets
Equities → 252-day, 6.5-hour sessions
No manual configuration required.
🔹 Extreme Value Moderation
During periods of high volatility or reduced estimation reliability, ASR+ moderates extreme Sharpe values in both directions. Positive readings may be reduced, while negative readings may move closer to zero, reflecting lower statistical confidence rather than a change in underlying performance.
🔹 Logarithmic Returns
ASR+ uses logarithmic (log) returns instead of arithmetic returns. Log returns are time-additive and more statistically consistent across timeframes, improving the stability and comparability of risk-adjusted performance, particularly over longer horizons and in the presence of compounding.
ADAPTIVE VS STANDARD SHARPE
Toggle between:
Standard Sharpe → baseline calculation (thinner line)
ASR+ → adjusted, real-world version (thicker line)
Use this to:
Detect inflated Sharpe values
Reveal hidden risk
Validate strategy robustness
─────────────────────────────────────────
REGIME CLASSIFICATION
─────────────────────────────────────────
Light theme view for clarity and accessibility. The same regime classification logic is applied across themes.
ASR+ colors both the plotted line and background for instant interpretation:
🔴 Red → Below 0 — Negative risk-adjusted return
⚫ Gray → 0 to 1 — Subpar performance
🟢 Green → 1 to 2 — Good performance
💚 Lime → Above 2 — Exceptional performance
─────────────────────────────────────────
KEY INPUTS & SETTINGS
─────────────────────────────────────────
→ Lookback Period
Minimum: 50 bars (Daily & Intraday), 36 (Weekly), 24 (Monthly)
Recommended: 63 (Daily), 100 (4H), 252 (1H), 500 (30M)
For high-volatility assets (e.g., growth stocks, crypto), longer lookbacks are recommended to reduce sensitivity to short-term trends
Short lookbacks during strong trending conditions can produce elevated readings that reflect momentum rather than sustainable risk-adjusted performance
→ Risk-Free Rate
Annualized (default 4.5%), adjustable to reflect prevailing rates
→ Show Adaptive vs Standard Sharpe
Plot both to visualize adjustment magnitude
→ EMA Smoother
Optional smoothing to reduce noise
→ Background Regime Colors
Fully customizable
─────────────────────────────────────────
WHO THIS IS FOR
─────────────────────────────────────────
→ Quantitative traders evaluating strategies
→ Multi-asset traders needing consistent metrics
→ Risk-conscious traders focused on efficiency, not just returns
→ Systematic traders monitoring regime shifts in real time
IMPORTANT
ASR+ is not a buy/sell signal.
It measures the quality of returns to support:
Strategy evaluation
Risk control
Position sizing
All calculations are based on confirmed historical data and do not rely on future values.
─────────────────────────────────────────
Built with statistical rigor for traders who demand more accurate evaluation tools.
─────────────────────────────────────────
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.