OPEN-SOURCE SCRIPT

Sortino + Omega + PSR + Ulcer [Wall Street Pro

323
[Script Introduction]
Within Quantamental and macro-hedging frameworks, the traditional mean-variance theory (such as the traditional Sharpe Ratio) possesses a fatal flaw: it penalizes "good" upside volatility and fails to identify the "black swan" DNA inherent in non-normal distributions.

This script, Sortino + Omega + PSR + Ulcer [Wall Street Pro], is an institutional-grade asset "personality" diagnostic and performance attribution system. By visualizing higher-order moment statistics (Skewness, Kurtosis) alongside path-dependent drawdown risk (Ulcer Index), it is designed to help traders identify pseudo-high-yield/pseudo-high-win-rate assets that are essentially "picking up pennies in front of a steamroller," and to discover true Alpha backed by genuine microstructure advantages.

[Core Parameters & Practical Significance]

Sortino vs. Sharpe Ratio: Debunks the volatility illusion. By only penalizing downside volatility, a Sortino ratio significantly higher than the Sharpe ratio indicates that the asset possesses immense upside explosive power.

Skewness & Kurtosis: The tail-risk detectors. Specifically designed to capture hidden "fat-tail" risks (e.g., gap-downs from unexpected blow-ups). Extreme skewness and high kurtosis often signal devastating losses during liquidity dry-ups.

PSR (Probabilistic Sharpe Ratio): The performance lie detector. By incorporating non-normal distribution parameters, it calculates the statistical probability that a strategy is genuinely effective, filtering out historical backtest illusions driven purely by luck.

Ulcer Index & Global Underwater Curve: Measures the integral of "drawdown depth × duration of distress." Paired with intuitive underwater region visualizations on the main chart, it evaluates the pressure the asset exerts on capital chains and traders' psychological defenses.

Omega Ratio: The overarching profit/loss scale, evaluating the overall quality of the winning probability across the entire return distribution.

[Application Scenarios]

Liquidity stress testing for broad market indices and high-Beta assets (e.g., microstructure comparisons between SPX and MSTR).

Validation of macro-hedge allocations (e.g., testing the reduction in a portfolio's Ulcer Index after incorporating safe-haven assets like precious metals).

"Mine-sweeping" for CTA and high-dividend strategies (identifying assets with deep negative skewness).量化基本面(Quantamental)与宏观对冲框架下,传统的均值-方差理论(如传统夏普比率)存在致命缺陷:它惩罚了向上的好波动,且无法识别非正态分布下的“黑天鹅”基因。

本脚本 Sortino + Omega + PSR + Ulcer [Wall Street Pro] 是一套机构级的资产“性格”体检与业绩归因系统。它将高阶矩统计(偏度、峰度)与路径回撤风险(溃疡指数)可视化,旨在帮助交易者识别出那些“在推土机前捡硬币”的伪高息/伪高胜率资产,寻找真正具备微观结构优势的Alpha。

【核心参数与实战意义】

Sortino (索提诺比率) vs Sharpe (夏普比率): 破解波动率错觉。只惩罚下行波动,当 Sortino 显著大于 Sharpe 时,标明该资产具备极强的向上爆发力。

Skew (偏度) & Kurt (峰度): 尾部风险照妖镜。专门捕捉隐藏的“肥尾”风险(如暴雷跳空)。高偏度/高峰度往往意味着流动性枯竭时的毁灭性打击。

PSR (概率夏普比率): 业绩测谎仪。引入非正态分布参数,计算策略真实有效的统计学概率,过滤掉纯靠运气的历史回测幻觉。

Ulcer Index (溃疡指数) & 全局水下曲线: 衡量“套牢深度 × 煎熬时间”的积分。配合主图直观的水下区域可视化,评估资产对资金链和交易者心理防线的压迫程度。

Omega Ratio (全分布比率): 统揽全局的盈亏天平,评估整体赢面质量。

【适用场景】

大盘指数与高Beta资产的流动性压力测试(如 SPX 与 MSTR 的微观结构对比)。

宏观对冲配置的有效性验证(测试加入贵金属等避险资产后,组合溃疡指数的下降程度)。

CTA及高股息策略的“排雷”(识别深负偏度资产)。

【使用建议】
建议配合多锚点 VWAP (Anchored VWAP) 使用。当资产价格跌破核心机构成本线,且本指标面板中的 Sortino 出现倒挂、Ulcer 快速攀升时,往往是微观结构恶化、宏观流动性退潮的右侧确认信号。

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.