OPEN-SOURCE SCRIPT

Jensen Alpha RS

117
🧠 Jensen Alpha RS (J-Alpha RS)
Jensen Alpha RS is a quantitative performance evaluation tool designed to compare multiple assets against a benchmark using Jensen’s Alpha — a classic risk-adjusted return metric from modern portfolio theory.
It helps identify which assets have outperformed their benchmark on a risk-adjusted basis and ranks them in real time, with optional gating and visual tools. 📊

✨ Key Features
• 🧩 Multi-Asset Comparison: Evaluate up to four assets simultaneously.
• 🔀 Adaptive Benchmarking: TOTALES mode uses CRYPTOCAP:TOTALES (total crypto market cap ex-stablecoins). Dynamic mode automatically selects the strongest benchmark among BTC, ETH, and TOTALES based on rolling momentum.
• 📐 Jensen’s Alpha Calculation: Uses rolling covariance, variance, and beta to estimate α, showing how much each asset outperformed its benchmark.
• 📈 Z-Score & Consistency Metrics: Z-Score highlights statistical deviations in alpha; Consistency % shows how often α has been positive over a chosen window.
• 🚦 Trend & Zero Gates: Optional filters that require assets to be above EMA (trend) and/or have α > 0 for confirmation.
• 🏆 Leaders Board Table: Displays α, Z, Rank, Consistency %, and Gate ✓/✗ for all assets in a clear visual layout.
• 🔔 Dynamic Alerts: Get notified whenever the top alpha leader changes on confirmed (non-repainting) data.
• 🎨 Visual Enhancements: Smooth α with an SMA or color bars by the current top-performing asset.

🧭 Typical Use Cases
• 🔄 Portfolio Rotation & Relative Strength: Identify which assets consistently outperform their benchmark to optimize capital allocation.
• 🧮 Alpha Persistence Analysis: Gauge whether a trend’s performance advantage is statistically sustainable.
• 🌐 Market Regime Insight: Observe how asset leadership rotates as benchmarks shift across market cycles.

⚙️ Inputs Overview
• 📝 Assets (1–4): Select up to four tickers for evaluation.
• 🧭 Benchmark Mode: Choose between static TOTALES or Dynamic auto-selection.
• 📏 Alpha Settings: Adjustable lookback, smoothing, and consistency windows.
• 🚦 Gates: Optional trend and alpha filters to refine results.
• 🖥️ Display: Enable/disable table and customize colors.
• 🔔 Alerts: Toggle notifications on leadership changes.

🔎 Formula Basis
Jensen’s Alpha (α) is estimated as:
α = E[Ra] − β × E[Rb]
where β = Cov(Ra, Rb) / Var(Rb), and Ra/Rb represent asset and benchmark returns, respectively.
A positive α indicates outperformance relative to the risk-adjusted benchmark expectation. ✅

⚠️ Disclaimer
This script is for educational and analytical purposes only.
It is NOT a signal. 🚫📉
It does not constitute financial advice, trading signals, or investment recommendations. 💬
The author is not responsible for any financial losses or trading decisions made based on this indicator. 🙏
Always perform your own analysis and use proper risk management. 🛡️

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.