OPEN-SOURCE SCRIPT
已更新

Gabriel's MPT Moving Average Ribbon

55
Gabriel's MPT Moving Average Ribbon is a cutting-edge, risk-adjusted technical analysis tool that fuses Modern Portfolio Theory (MPT) with adaptive moving average logic to dynamically guide market participants through bullish and bearish conditions.

This ribbon is not a simple MA crossover — it leverages Sharpe Ratio, Sortino Ratio, Omega Ratio, and Value at Risk (VaR) to scale and smooth each moving average using real-time probabilistic efficiency metrics. Combined, these elements create a volatility-weighted, risk-optimized visualization of market structure.

🔍 Core Features:
Multi-Ratio Adaptive Scaling: Moving averages are dynamically weighted by Omega Ratio, Sortino Stdev, Sharpe Winrate, and VaR conditions for smarter price tracking.

Volatility Engine: Supports multiple return models:

Close-to-Close

Parkinson

Garman-Klass

Rogers–Satchell

Yang–Zhang (default for highest accuracy)

Smart Ribbon Construction:

Blends 3 different MA types per ribbon (e.g., SMA, EMA, WMA) for each of the 4 ribbons

Supports WMA-style dynamic weighting using MPT-derived ratios

Sharpe Winrate Estimation: Uses CDF logic to project the probability of success given current Sharpe ratio.

Dynamic Risk Phase Detection (VaR):

Identifies Risk On, Risk Off, or Neutral states using a triple-model composite VaR framework.

🛎️ Alerts Included:
📈 Bullish Crossover Alert: MA #1 crossing above MA #2 with all ribbons aligned upward.

📉 Bearish Crossunder Alert: MA #1 crossing below MA #2 with all ribbons aligned downward.

📊 Omega Ratio Alert: Triggered when Omega exceeds 1 (profitable risk-adjusted reward).

⚠️ Omega Caution Alert: Triggered when Omega drops below 1.

🟢 Risk On Alert: Market enters a favorable, low-risk zone. Deep Value Zone for Long-Term Investing.

🔴 Risk Off Alert: Market enters a cautionary, high-risk phase.

🎯 Use Cases:
Trend Identification: MA ribbon alignment indicates momentum phases.

Risk-Tuned Entries/Exits: Combine ribbon crossovers with VaR/Ratio signals for confirmation.

Institutional Strategy Overlay: Ideal for portfolio managers integrating risk-adjusted technical overlays.

🧠 Pro Tips:
Use "Complete" mode for the most robust risk signal, as it blends Historical, EWMA, and Variance-Covariance ratios.

Customize each MA’s type and length to match your trading horizon (e.g., intraday, swing).

Toggle Ratios Weighted MA for adaptive weighting when market risk fluctuates.

It's set to the settings I use to trade, from MA settings to MPT table. It goes in order: Sharpe Est. Winrate, Deviation of Sortino, Omega Ratio (1 Year), and the Ideal position size according to VaR.
發行說明
I added two new alerts.

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。