OPEN-SOURCE SCRIPT
已更新 Comparison Lines with Labels

What It Does
This indicator overlays up to 7 additional ticker symbols onto your main chart as rebased price lines, allowing direct visual comparison of relative performance across multiple assets simultaneously.
The key mechanic is percentage rebasing: every line — including the main chart's own price — is normalised so that all series start at the same price point (the main chart's closing price at the left edge of your visible window). This means you're not comparing absolute prices, you're comparing relative returns from a common starting point.
Because the anchor point is tied to the visible left edge rather than a fixed date, the comparison automatically adjusts whenever you scroll or zoom. Every time you change your view window, all lines re-anchor together — no manual reconfiguration required.
End-of-Line Labels
Each line displays a floating label at the right edge of the chart showing:
The ticker symbol or full instrument name (your choice)
The % return from the visible left edge (e.g. +12.45% or -3.20%)
Labels stay pinned to their line's current price level at all times. Unlike static text boxes, they never need to be repositioned after zooming, scrolling, or changing timeframes — they're always exactly where you need them.
Intended Use Case — Sector Rotation & Comparative Analysis
The primary use case is sector scanning and money flow analysis. Load a basket of related tickers — for example, a set of sector ETFs, a group of resource stocks, or competing names within a theme — and immediately see:
Which instrument is leading or lagging from any given starting point
Where relative momentum is strongest
How quickly the spread between instruments is widening or narrowing
Because you can run up to 7 comparisons at once and each line is clearly labelled with its name and return percentage, you can monitor a dense watchlist without needing to cross-reference a legend, create manual text annotations, or maintain separate charts.
Settings Reference
GroupSettingPurposeSymbolsSymbol 1–7Enter any valid TradingView ticker (e.g. ASX:BHP, AMEX:XLE)SymbolsShow Base Symbol LinePlots the main chart's own rebased line — hidden by default as it overlaps candlesDisplayShow % Return in LabelAppends the return figure to each end labelDisplayShow Display NameUses the instrument's full name instead of the raw ticker codeDisplayShow Anchor Dot at StartPlaces a small circle on each line at the rebasing anchor barDisplayLabel OffsetPushes labels right by N bars so they don't overlap the last candleDisplayLine WidthVisual thickness of comparison lines (1–4)ColorsBase / Symbol 1–7Individual colour assignment per line
Important Notes
Remove any previous version before adding this indicator — two copies will cause price scale conflicts.
The indicator runs on the same timeframe as the main chart. Switching timeframes resets and recalculates everything automatically.
If a comparison ticker has no data at the visible left edge (e.g. a recently listed stock), its line will rebase from its own first available bar instead. The anchor dot will appear at a different height on those tickers, which is a visual cue that the start point differs.
max_labels_count=50 is set at the indicator level — labels are deleted and recreated on every tick so only the current set persists.
This indicator overlays up to 7 additional ticker symbols onto your main chart as rebased price lines, allowing direct visual comparison of relative performance across multiple assets simultaneously.
The key mechanic is percentage rebasing: every line — including the main chart's own price — is normalised so that all series start at the same price point (the main chart's closing price at the left edge of your visible window). This means you're not comparing absolute prices, you're comparing relative returns from a common starting point.
Because the anchor point is tied to the visible left edge rather than a fixed date, the comparison automatically adjusts whenever you scroll or zoom. Every time you change your view window, all lines re-anchor together — no manual reconfiguration required.
End-of-Line Labels
Each line displays a floating label at the right edge of the chart showing:
The ticker symbol or full instrument name (your choice)
The % return from the visible left edge (e.g. +12.45% or -3.20%)
Labels stay pinned to their line's current price level at all times. Unlike static text boxes, they never need to be repositioned after zooming, scrolling, or changing timeframes — they're always exactly where you need them.
Intended Use Case — Sector Rotation & Comparative Analysis
The primary use case is sector scanning and money flow analysis. Load a basket of related tickers — for example, a set of sector ETFs, a group of resource stocks, or competing names within a theme — and immediately see:
Which instrument is leading or lagging from any given starting point
Where relative momentum is strongest
How quickly the spread between instruments is widening or narrowing
Because you can run up to 7 comparisons at once and each line is clearly labelled with its name and return percentage, you can monitor a dense watchlist without needing to cross-reference a legend, create manual text annotations, or maintain separate charts.
Settings Reference
GroupSettingPurposeSymbolsSymbol 1–7Enter any valid TradingView ticker (e.g. ASX:BHP, AMEX:XLE)SymbolsShow Base Symbol LinePlots the main chart's own rebased line — hidden by default as it overlaps candlesDisplayShow % Return in LabelAppends the return figure to each end labelDisplayShow Display NameUses the instrument's full name instead of the raw ticker codeDisplayShow Anchor Dot at StartPlaces a small circle on each line at the rebasing anchor barDisplayLabel OffsetPushes labels right by N bars so they don't overlap the last candleDisplayLine WidthVisual thickness of comparison lines (1–4)ColorsBase / Symbol 1–7Individual colour assignment per line
Important Notes
Remove any previous version before adding this indicator — two copies will cause price scale conflicts.
The indicator runs on the same timeframe as the main chart. Switching timeframes resets and recalculates everything automatically.
If a comparison ticker has no data at the visible left edge (e.g. a recently listed stock), its line will rebase from its own first available bar instead. The anchor dot will appear at a different height on those tickers, which is a visual cue that the start point differs.
max_labels_count=50 is set at the indicator level — labels are deleted and recreated on every tick so only the current set persists.
版本注释
Updated to allow up to 15 comparison lines and also added RSC comparison functionality. For the RSC comparison feature, each comparison line is benchmarked bar-by-bar against a configurable ticker (default ASX:XJO). The RSC ratio is calculated as symbol price / benchmark price, and its rate of change over a rolling lookback window is used to measure momentum. When a symbol is gaining ground on the benchmark its line brightens (becomes more opaque); when it is losing ground the line fades. The speed at which a line reaches full brightness is controlled by the ROC Scale — a higher value requires stronger outperformance before the line fully brightens. The end-of-line label also shows the cumulative RSC % change since the visible left edge, so you can see at a glance both absolute return and relative performance against the benchmark over the same window.版本注释
Add setting to enable and disable the RSC comparison开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。