INVITE-ONLY SCRIPT

Sortino Ratio -> The NeW System

13
Sortino Ratio → The NeW System 🚀
Calculate and visualize an annualized, smoothed Sortino Ratio that focuses on downside volatility.

What is the Sortino Ratio? 🤔
The Sortino Ratio is a risk-adjusted performance metric like the Sharpe Ratio, but it only penalizes returns below a chosen benchmark (usually the risk-free rate). By isolating “bad” volatility—periods when your returns dip under that minimum—it shows you how well an asset rewards you for downside risk alone. 📉

Indicator Inputs ⚙️
Source 📊: the price series to calculate returns from (e.g. close price).

Calculation Period 📆: the number of days/bars used to compute average returns and downside volatility. Longer periods smooth out noise; shorter periods react faster.

Annual Risk-Free Rate (%) 💰: the minimum acceptable yearly return, converted internally to a per-bar rate. In crypto, you might set this to zero.

Smoothing Period (EMA) 🔄: how many periods to apply an exponential moving average to the raw Sortino Ratio, reducing spikes and making trends clearer.

Strong Threshold 🟢: above this level the line turns green, signaling robust downside-risk-adjusted performance.

Weak Threshold 🔴: below this level the line turns red, warning of underperformance relative to downside risk.

How the Indicator Works 🧮
Compute periodic returns by comparing each bar’s price to the prior bar.

Convert annual risk-free rate to a per-bar rate (divide by 365 for daily bars).

Calculate average return over the chosen period.

Measure downside deviation by squaring only the shortfalls below the risk-free rate, averaging them, and then taking the square root.

Form the raw Sortino Ratio by subtracting the per-bar risk-free rate from the average return, dividing by downside deviation, and annualizing. If downside deviation is zero, it defaults to zero to avoid errors.

Smooth with EMA to filter noise and highlight the underlying trend.

Plot & Interpretation 🎨
Line Color

🟢 Green when the smoothed Sortino Ratio ≥ Strong Threshold (strong downside-risk-adjusted returns).

🔴 Red when ≤ Weak Threshold (weak or negative performance).

⚪ Gray between thresholds (neutral zone).

Threshold Lines

Dashed green line at the Strong Threshold.

Dashed red line at the Weak Threshold.

Pro Tips 💡
A Sortino Ratio around 1 means returns match downside risk on a 1:1 basis—generally acceptable -> Long Term.

Below 0 indicates returns haven’t beaten your minimum acceptable rate.

Above 2 signals excellent downside-risk-adjusted performance—even in volatile markets like crypto, values slightly below 2 can still be strong -> Long Term.

Use this system to spot when an asset’s returns aren’t just high, but safely high—helping you trade with confidence and minimize nasty drawdowns! 🎯

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.