OPEN-SOURCE SCRIPT
Risk-Adjusted Performance Rankings | NickJoan

Risk-Adjusted Performance Rankings | NickJoan
Core Idea
Risk-Adjusted Performance Rankings is a multi-asset comparison dashboard designed to rank up to 15 symbols by how efficiently they convert recent price movement into risk-adjusted return. Instead of looking only at raw price performance, the indicator evaluates three classic performance measures: Sharpe, Sortino and Omega over a user-defined lookback window and organizes the results into a table.
The script can be used in two ways:
• As a metrics table, where all three risk-adjusted values are shown side by side for each asset.
• As a ranking tool, where the symbols are sorted by Sharpe, Sortino, Omega, or a composite Z-Score score.
Calculation Logic
The indicator works by taking the percentage return of each symbol over the selected period and then building three separate statistics from that same return stream.
1. Return calculation
For each symbol, the script first calculates the one-bar rate of change. This creates a rolling return series that acts as the base input for all three risk-adjusted metrics.
2. Sharpe ratio
The Sharpe calculation measures average return relative to total return volatility.
• The script calculates the mean of returns over the selected lookback.
• It calculates the standard deviation of those returns.
• It divides mean return by standard deviation.
• It then multiplies by the square root of the lookback length to create a rolling-style scaled value.
In practical terms, a higher Sharpe reading means the asset has produced more return for each unit of total volatility.
3. Sortino ratio
The Sortino ratio is similar to Sharpe, but it only penalizes downside volatility.
• The script collects only negative returns from the lookback window.
• It computes the standard deviation of those downside returns.
• It divides mean return by that downside deviation.
• It then scales the result by the square root of the lookback.
This means Sortino rewards assets that may have volatile upside moves but relatively controlled downside behavior.
4. Omega ratio
The Omega calculation compares total gains to total losses over the selected window.
• All positive returns are summed as gains.
• All negative returns are converted to positive values and summed as losses.
• Omega is computed as the ratio of total gains to total losses.
A value above 1 suggests gains outweigh losses, while a value below 1 suggests the opposite.
Ranking Logic
The indicator supports several ranking modes, and each one uses the same asset list but applies a different sort key.
Metrics Table
In Metrics Table mode, the script shows:
• The ticker name.
• Sharpe.
• Sortino.
• Omega.
This mode is the most direct view if you want to inspect each asset’s raw values without sorting.
Sharpe / Sortino / Omega ranking
When one of these modes is selected:
• The table sorts the assets by that chosen metric.
• The highest values appear at the top.
• The table becomes a direct performance leaderboard.
Z-Score ranking
The Z-Score mode is a composite ranking system.
• The script first computes the mean and standard deviation of each metric across all 15 assets.
• It then converts each asset’s Sharpe, Sortino, and Omega into z-scores.
• Those three standardized values are averaged into one composite score.
• Assets are sorted by that final score.
This allows apples-to-apples comparison even when the raw metrics live on different numeric scales.
What the Colors Mean
The script uses color thresholds to make the table easier to read at a glance.
Sharpe colors
Sharpe cells are colored according to the input range defined by:
• Sharpe Min
• Sharpe Max
Values below the minimum are treated as weak.
Values between the lower zone and upper zone are shown as progressively stronger.
Values above the upper threshold are treated as strong.
Sortino colors
Sortino uses the same idea, but with its own range:
• Sortino Min
• Sortino Max
This allows the heatmap to reflect downside-adjusted performance independently from Sharpe.
Omega colors
Omega is especially important because it is naturally centered around 1.0.
• Values below the lower threshold are weak.
• Values between the band limits gradually improve.
• Values above the upper threshold are strong.
Z-Score colors
The Z-Score mode uses a standardized color logic:
• Strongly negative values are weak.
• Slightly negative values are mid-negative.
• Slightly positive values are mid-positive.
• Strongly positive values are strong.
This helps show whether an asset is above or below the group average on a normalized basis.
Table Output
Metrics Table output
In this mode, the table displays:
• Column 1: ticker.
• Column 2: Sharpe.
• Column 3: Sortino.
• Column 4: Omega.
Single-metric ranking output
In Sharpe, Sortino, and Omega modes, the table displays:
• Rank number.
• Ticker.
• Chosen metric.
This keeps the interface minimal while still showing the full ranked order.
Z-Score output
In this mode, the table displays:
• Rank number.
• Ticker.
• Sharpe Z.
• Sortino Z.
• Omega Z.
• Average score.
This view is useful when you want a compact, relative ranking rather than raw values.
Inputs
The indicator has four main input groups.
Calculation
• Period: defines the lookback window used for all metric calculations.
Table
• Display Mode: chooses between Metrics Table, Sharpe, Sortino, Omega, and Z-Score.
• Table Position: controls where the table is placed on the chart.
Color Scale
• Sharpe Min / Max: controls the heatmap thresholds for Sharpe.
• Sortino Min / Max: controls the heatmap thresholds for Sortino.
• Omega Min / Max: controls the heatmap thresholds for Omega.
Colors
• Strong: the strongest positive color.
• Mid +: the intermediate positive color.
• Mid -: the intermediate negative color.
• Weak: the weakest negative color.
Tickers
The script includes 15 symbol inputs, allowing you to compare a basket of assets at once. This makes it suitable for crypto rotation, watchlist comparison, or broad performance ranking across a selected universe.
How to Use It
This indicator is best used as a relative strength and quality filter, not as a standalone entry signal.
Trend selection
Use the ranking table to see which assets are showing the best risk-adjusted behavior over the chosen period.
Rotation analysis
If you track a basket of coins or market leaders, the indicator can help identify which names are improving in risk-adjusted terms and which ones are losing momentum.
Risk control
A raw gain is not always useful if it comes with excessive volatility or poor downside behavior. This script helps highlight assets with better return efficiency, not just bigger movement.
Multi-factor comparison
Because Sharpe, Sortino, and Omega emphasize different aspects of return quality, the script gives a more balanced view than a single metric alone.
Practical Interpretation
Here is a simple way to read the results:
• High Sharpe: efficient return relative to total volatility.
• High Sortino: strong return with less downside volatility.
• High Omega: gains outweigh losses over the lookback window.
• High Z-Score average: strong performance relative to the rest of the selected universe.
If an asset scores well across all three, it usually represents a stronger and more stable candidate than one that only looks good on one metric.
Best Use Cases
Typical uses include:
• Crypto basket comparison.
• Top-asset ranking.
• Risk-adjusted momentum filtering.
• Rotation watchlists.
• Regime-aware asset selection.
It is especially useful when you want to compare many symbols quickly without manually calculating which ones are actually performing best on a quality-adjusted basis.
Notes
The metric table is only as good as the selected lookback period and asset set.
• Shorter periods react faster but can be noisier.
• Longer periods smooth the results but may lag recent shifts.
• The Z-Score mode is relative to the selected group, so its meaning depends on the symbols you include.
Core Idea
Risk-Adjusted Performance Rankings is a multi-asset comparison dashboard designed to rank up to 15 symbols by how efficiently they convert recent price movement into risk-adjusted return. Instead of looking only at raw price performance, the indicator evaluates three classic performance measures: Sharpe, Sortino and Omega over a user-defined lookback window and organizes the results into a table.
The script can be used in two ways:
• As a metrics table, where all three risk-adjusted values are shown side by side for each asset.
• As a ranking tool, where the symbols are sorted by Sharpe, Sortino, Omega, or a composite Z-Score score.
Calculation Logic
The indicator works by taking the percentage return of each symbol over the selected period and then building three separate statistics from that same return stream.
1. Return calculation
For each symbol, the script first calculates the one-bar rate of change. This creates a rolling return series that acts as the base input for all three risk-adjusted metrics.
2. Sharpe ratio
The Sharpe calculation measures average return relative to total return volatility.
• The script calculates the mean of returns over the selected lookback.
• It calculates the standard deviation of those returns.
• It divides mean return by standard deviation.
• It then multiplies by the square root of the lookback length to create a rolling-style scaled value.
In practical terms, a higher Sharpe reading means the asset has produced more return for each unit of total volatility.
3. Sortino ratio
The Sortino ratio is similar to Sharpe, but it only penalizes downside volatility.
• The script collects only negative returns from the lookback window.
• It computes the standard deviation of those downside returns.
• It divides mean return by that downside deviation.
• It then scales the result by the square root of the lookback.
This means Sortino rewards assets that may have volatile upside moves but relatively controlled downside behavior.
4. Omega ratio
The Omega calculation compares total gains to total losses over the selected window.
• All positive returns are summed as gains.
• All negative returns are converted to positive values and summed as losses.
• Omega is computed as the ratio of total gains to total losses.
A value above 1 suggests gains outweigh losses, while a value below 1 suggests the opposite.
Ranking Logic
The indicator supports several ranking modes, and each one uses the same asset list but applies a different sort key.
Metrics Table
In Metrics Table mode, the script shows:
• The ticker name.
• Sharpe.
• Sortino.
• Omega.
This mode is the most direct view if you want to inspect each asset’s raw values without sorting.
Sharpe / Sortino / Omega ranking
When one of these modes is selected:
• The table sorts the assets by that chosen metric.
• The highest values appear at the top.
• The table becomes a direct performance leaderboard.
Z-Score ranking
The Z-Score mode is a composite ranking system.
• The script first computes the mean and standard deviation of each metric across all 15 assets.
• It then converts each asset’s Sharpe, Sortino, and Omega into z-scores.
• Those three standardized values are averaged into one composite score.
• Assets are sorted by that final score.
This allows apples-to-apples comparison even when the raw metrics live on different numeric scales.
What the Colors Mean
The script uses color thresholds to make the table easier to read at a glance.
Sharpe colors
Sharpe cells are colored according to the input range defined by:
• Sharpe Min
• Sharpe Max
Values below the minimum are treated as weak.
Values between the lower zone and upper zone are shown as progressively stronger.
Values above the upper threshold are treated as strong.
Sortino colors
Sortino uses the same idea, but with its own range:
• Sortino Min
• Sortino Max
This allows the heatmap to reflect downside-adjusted performance independently from Sharpe.
Omega colors
Omega is especially important because it is naturally centered around 1.0.
• Values below the lower threshold are weak.
• Values between the band limits gradually improve.
• Values above the upper threshold are strong.
Z-Score colors
The Z-Score mode uses a standardized color logic:
• Strongly negative values are weak.
• Slightly negative values are mid-negative.
• Slightly positive values are mid-positive.
• Strongly positive values are strong.
This helps show whether an asset is above or below the group average on a normalized basis.
Table Output
Metrics Table output
In this mode, the table displays:
• Column 1: ticker.
• Column 2: Sharpe.
• Column 3: Sortino.
• Column 4: Omega.
Single-metric ranking output
In Sharpe, Sortino, and Omega modes, the table displays:
• Rank number.
• Ticker.
• Chosen metric.
This keeps the interface minimal while still showing the full ranked order.
Z-Score output
In this mode, the table displays:
• Rank number.
• Ticker.
• Sharpe Z.
• Sortino Z.
• Omega Z.
• Average score.
This view is useful when you want a compact, relative ranking rather than raw values.
Inputs
The indicator has four main input groups.
Calculation
• Period: defines the lookback window used for all metric calculations.
Table
• Display Mode: chooses between Metrics Table, Sharpe, Sortino, Omega, and Z-Score.
• Table Position: controls where the table is placed on the chart.
Color Scale
• Sharpe Min / Max: controls the heatmap thresholds for Sharpe.
• Sortino Min / Max: controls the heatmap thresholds for Sortino.
• Omega Min / Max: controls the heatmap thresholds for Omega.
Colors
• Strong: the strongest positive color.
• Mid +: the intermediate positive color.
• Mid -: the intermediate negative color.
• Weak: the weakest negative color.
Tickers
The script includes 15 symbol inputs, allowing you to compare a basket of assets at once. This makes it suitable for crypto rotation, watchlist comparison, or broad performance ranking across a selected universe.
How to Use It
This indicator is best used as a relative strength and quality filter, not as a standalone entry signal.
Trend selection
Use the ranking table to see which assets are showing the best risk-adjusted behavior over the chosen period.
Rotation analysis
If you track a basket of coins or market leaders, the indicator can help identify which names are improving in risk-adjusted terms and which ones are losing momentum.
Risk control
A raw gain is not always useful if it comes with excessive volatility or poor downside behavior. This script helps highlight assets with better return efficiency, not just bigger movement.
Multi-factor comparison
Because Sharpe, Sortino, and Omega emphasize different aspects of return quality, the script gives a more balanced view than a single metric alone.
Practical Interpretation
Here is a simple way to read the results:
• High Sharpe: efficient return relative to total volatility.
• High Sortino: strong return with less downside volatility.
• High Omega: gains outweigh losses over the lookback window.
• High Z-Score average: strong performance relative to the rest of the selected universe.
If an asset scores well across all three, it usually represents a stronger and more stable candidate than one that only looks good on one metric.
Best Use Cases
Typical uses include:
• Crypto basket comparison.
• Top-asset ranking.
• Risk-adjusted momentum filtering.
• Rotation watchlists.
• Regime-aware asset selection.
It is especially useful when you want to compare many symbols quickly without manually calculating which ones are actually performing best on a quality-adjusted basis.
Notes
The metric table is only as good as the selected lookback period and asset set.
• Shorter periods react faster but can be noisier.
• Longer periods smooth the results but may lag recent shifts.
• The Z-Score mode is relative to the selected group, so its meaning depends on the symbols you include.
สคริปต์แบบโอเพนซอร์ส
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์แบบโอเพนซอร์ส
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน