OPEN-SOURCE SCRIPT
Updated TOPIX Relative Strength vs Symbol + Volume Quality (JP)

Overview
Relative Strength vs Symbol + Volume Quality (JP) visualizes the relative performance (%) of a stock versus a chosen benchmark (e.g., TOPIX, Nikkei 225, or ETFs) while incorporating volume quality and momentum analysis.
It calculates percentage-point differences between the target and benchmark, smooths them (EMA/SMA), and evaluates whether the strength is supported by quality volume flow.
All data uses confirmed bars only (request.security() with confirmed values) to minimize repainting, and labels are drawn only on confirmed bars.
What It Shows
Relative Performance (%pt): Difference in rate of change between the stock and its benchmark.
Above 0 → outperforming
Below 0 → underperforming
Trend Direction: Short-/mid-term trend from smoothed EMA/SMA.
Volume Quality: Ratio of up-volume to down-volume, scaled from -1 to +1.
Volume Momentum (Z-Score): Measures unusual surges in trading activity.
Strength Detection: Combines price-based strength (relative or z-score) with volume quality and momentum filters.
How to Use
Set your comparison symbol (e.g., TSE:1306, TVC:NI225).
Adjust lookback length and smoothing period/type to fit your analysis window.
Enable “Confirm strength by volume quality” and/or “Use volume Z-score” to filter signals with supportive volume.
Optionally, configure background thresholds to highlight extreme relative strength/weakness.
Use Screener Mode to suppress visual outputs (table/labels) for performance in Pine Screener.
Main Input Groups
Comparison Settings: Benchmark symbol, calculation timeframe.
Period & Smoothing: lookback, smoothLen, and MA type (EMA or SMA).
Price Strength Detection: Enable Z-score mode and adjust zLen / zThresh.
Volume Quality & Momentum: vqThresh (volume quality) and vZth (Z-score threshold).
Display: Toggle histogram tint, background highlight, mini-table, and signal labels.
Background Thresholds: Independent thresholds for histogram/MA lines and colors.
Screener Output: Suppress visuals for screening use.
Output & Coloring
Histogram: Relative performance in %pt. Red = outperforming, Green = underperforming (intensity by magnitude).
White Line (EMA/SMA):
Rising with good volume quality → Red
Rising but poor quality → Yellow
Falling → White
Background: Optional highlight when histogram/MA exceeds user thresholds.
Counters: Hidden plots track how many bars have consecutively exceeded thresholds (usable in screeners).
Alerts
Strength Detection (Price + Volume):
Triggered when price condition (MA > 0 or Z-score > threshold) and volume conditions are met.
Weakness / Loss of Strength:
Triggered on cross-under or when volume conditions fail.
Labels: Optional, shown only on confirmed bars.
Repaint Prevention
All calculations use confirmed bar data only.
Labels appear only when bars close.
On lower timeframes, benchmark update delays may cause minor lag.
Volume quality is derived from up/down bar classification, which can be distorted by gaps or illiquid markets.
Avoid overfitting thresholds — values differ by asset and timeframe.
Practical Applications
Identify outperformance with supportive volume across sectors or themes.
Use streak counters to find consistent relative winners or laggards.
Compare stocks vs sector indices or ETFs to track rotation and momentum shifts.
Disclaimer
This script and its description are provided for educational and informational purposes only.
They do not constitute financial advice or recommendations.
Use at your own discretion, considering market risk, liquidity, and data limitations.
This description follows TradingView’s House Rules (no promotion, plagiarism, or misleading claims).
Publication Guidelines
When publishing:
Do not include promotional links or invitations.
Do not copy text/code from other authors without permission.
Screenshots should illustrate the script’s function only, not serve as marketing material.
Maintain consistency of language (English only for this version).
概要
Relative Strength vs Symbol + Volume Quality (JP) は、対象銘柄と比較指標(例:TOPIX)との相対パフォーマンスを%ポイント差で算出し、平滑化線(EMA/SMA)とヒストグラムで可視化します。さらに、出来高を「質(上げ/下げボリュームのバランス)」と「勢い(Zスコア)」で評価し、価格×出来高の両面から“強さ/弱さ”を判定します。
リペイント抑制のため、request.security()は確定足を参照し、ラベル描画も確定時に限定しています。
何がわかるか
相対パフォーマンス(%pt):対象と比較指標の騰落率差。0より上=相対優位、下=相対劣位。
平滑化トレンド:相対の短中期的な傾き(EMA/SMA)。
出来高の質:上昇バー出来高と下降バー出来高の比から -1〜+1 で評価。
出来高の勢い(Zスコア):直近出来高の異常度。
強/弱シグナル:価格条件(基準越え・Z超え)に、出来高条件(質・勢い)を組み合わせて抽出。
使い方(基本手順)
比較対象を「比較シンボル」で指定(例:TSE:1306、TVC:NI225 等)。
「比較期間(バー数)」と「平滑化(期間/種類)」を調整し、相対の視点を合わせる。
出来高確認を使う場合は「出来高の質で“強さ”を確認」「出来高の勢い(Z)」をオンにし、閾値を調整。
背景ハイライトの**閾値(ヒスト/平均線別)**を設定すると、重要局面を一目で把握可能。
スクリーナー利用時は「スクリーナー用」をオンにして、テーブル/ラベルの描画を抑制。
主な入力項目
比較設定:比較シンボル、計算タイムフレーム。
期間・平滑化:比較期間lookback、平滑化長smoothLen、MA種別(EMA/SMA)。
強さ検出(価格):Zスコア方式のオン/オフ、zLen、zThresh。
出来高の質・勢い:質の閾値vqThresh、勢いZの長さvZlenと閾値vZth。
表示:テーブル、背景、ヒスト濃淡、直近ラベルのON/OFF。
背景(閾値):ヒスト/平均線の上下しきいと背景色。
スクリーナー出力:描画抑制トグル。
出力と色分け
ヒストグラム:相対パフォーマンス(%pt)。プラス域は赤系、マイナス域は緑系で濃淡表示。
白線(実体は平滑化相対):上向きかつ出来高質が閾値以上なら赤、上向きでも質不足なら黄、下降時は白。
背景色(任意):設定したヒスト/平均線の閾値を超過/割れで自動着色。
カウンタ:ヒスト/平均線が各閾値を連続超過/連続割れした本数を、スクリーナーが取得できるよう非表示プロットで出力。
シグナル・アラート
強さ検出(価格+出来高):
価格条件 … 平滑化線の0越え、またはZスコアがzThresh越え。
出来高条件 … 「質 ≥ vqThresh」「勢いZ ≥ vZth」(任意)。
条件一致で「強」アラート/喪失・未達で「弱」アラート。
ラベル(任意):確定足でのみ出力。
リペイントと制約
request.security()は確定足データを用い、確定時ラベルのみ描画する設計です。
比較シンボルの更新周期・分足集計差により、短期足ではタイムラグが生じる場合があります。
出来高の「質」は上昇/下降バーの単純仕分けに依存するため、ギャップや出来高の歪みが強い市場では解釈に注意。
閾値は銘柄・期間で最適値が異なります。**過度な最適化(カーブフィット)**は避けてください。
(公開ガイドライン上も、明確で誤解を生む表現の回避が推奨されます。
TradingView
)
活用アイデア(例)
相対優位×出来高質の改善が同時に起きた局面を抽出。
連続超過カウントで、相対の“粘り”や“伸び”をスクリーニング。
指数だけでなく、業種ETFやセクター指数を比較軸にしてローテーション把握。
免責
本スクリプトおよび説明は情報提供・教育目的です。投資助言・勧誘ではありません。市場リスク、流動性、スリッページ、データ仕様に起因する差異等は利用者の自己責任でご確認ください。TradingViewのハウスルール(広告禁止・独自性・言語一致・わかりやすさ)および公開ルールに準拠する形で記述しています。
Relative Strength vs Symbol + Volume Quality (JP) visualizes the relative performance (%) of a stock versus a chosen benchmark (e.g., TOPIX, Nikkei 225, or ETFs) while incorporating volume quality and momentum analysis.
It calculates percentage-point differences between the target and benchmark, smooths them (EMA/SMA), and evaluates whether the strength is supported by quality volume flow.
All data uses confirmed bars only (request.security() with confirmed values) to minimize repainting, and labels are drawn only on confirmed bars.
What It Shows
Relative Performance (%pt): Difference in rate of change between the stock and its benchmark.
Above 0 → outperforming
Below 0 → underperforming
Trend Direction: Short-/mid-term trend from smoothed EMA/SMA.
Volume Quality: Ratio of up-volume to down-volume, scaled from -1 to +1.
Volume Momentum (Z-Score): Measures unusual surges in trading activity.
Strength Detection: Combines price-based strength (relative or z-score) with volume quality and momentum filters.
How to Use
Set your comparison symbol (e.g., TSE:1306, TVC:NI225).
Adjust lookback length and smoothing period/type to fit your analysis window.
Enable “Confirm strength by volume quality” and/or “Use volume Z-score” to filter signals with supportive volume.
Optionally, configure background thresholds to highlight extreme relative strength/weakness.
Use Screener Mode to suppress visual outputs (table/labels) for performance in Pine Screener.
Main Input Groups
Comparison Settings: Benchmark symbol, calculation timeframe.
Period & Smoothing: lookback, smoothLen, and MA type (EMA or SMA).
Price Strength Detection: Enable Z-score mode and adjust zLen / zThresh.
Volume Quality & Momentum: vqThresh (volume quality) and vZth (Z-score threshold).
Display: Toggle histogram tint, background highlight, mini-table, and signal labels.
Background Thresholds: Independent thresholds for histogram/MA lines and colors.
Screener Output: Suppress visuals for screening use.
Output & Coloring
Histogram: Relative performance in %pt. Red = outperforming, Green = underperforming (intensity by magnitude).
White Line (EMA/SMA):
Rising with good volume quality → Red
Rising but poor quality → Yellow
Falling → White
Background: Optional highlight when histogram/MA exceeds user thresholds.
Counters: Hidden plots track how many bars have consecutively exceeded thresholds (usable in screeners).
Alerts
Strength Detection (Price + Volume):
Triggered when price condition (MA > 0 or Z-score > threshold) and volume conditions are met.
Weakness / Loss of Strength:
Triggered on cross-under or when volume conditions fail.
Labels: Optional, shown only on confirmed bars.
Repaint Prevention
All calculations use confirmed bar data only.
Labels appear only when bars close.
On lower timeframes, benchmark update delays may cause minor lag.
Volume quality is derived from up/down bar classification, which can be distorted by gaps or illiquid markets.
Avoid overfitting thresholds — values differ by asset and timeframe.
Practical Applications
Identify outperformance with supportive volume across sectors or themes.
Use streak counters to find consistent relative winners or laggards.
Compare stocks vs sector indices or ETFs to track rotation and momentum shifts.
Disclaimer
This script and its description are provided for educational and informational purposes only.
They do not constitute financial advice or recommendations.
Use at your own discretion, considering market risk, liquidity, and data limitations.
This description follows TradingView’s House Rules (no promotion, plagiarism, or misleading claims).
Publication Guidelines
When publishing:
Do not include promotional links or invitations.
Do not copy text/code from other authors without permission.
Screenshots should illustrate the script’s function only, not serve as marketing material.
Maintain consistency of language (English only for this version).
概要
Relative Strength vs Symbol + Volume Quality (JP) は、対象銘柄と比較指標(例:TOPIX)との相対パフォーマンスを%ポイント差で算出し、平滑化線(EMA/SMA)とヒストグラムで可視化します。さらに、出来高を「質(上げ/下げボリュームのバランス)」と「勢い(Zスコア)」で評価し、価格×出来高の両面から“強さ/弱さ”を判定します。
リペイント抑制のため、request.security()は確定足を参照し、ラベル描画も確定時に限定しています。
何がわかるか
相対パフォーマンス(%pt):対象と比較指標の騰落率差。0より上=相対優位、下=相対劣位。
平滑化トレンド:相対の短中期的な傾き(EMA/SMA)。
出来高の質:上昇バー出来高と下降バー出来高の比から -1〜+1 で評価。
出来高の勢い(Zスコア):直近出来高の異常度。
強/弱シグナル:価格条件(基準越え・Z超え)に、出来高条件(質・勢い)を組み合わせて抽出。
使い方(基本手順)
比較対象を「比較シンボル」で指定(例:TSE:1306、TVC:NI225 等)。
「比較期間(バー数)」と「平滑化(期間/種類)」を調整し、相対の視点を合わせる。
出来高確認を使う場合は「出来高の質で“強さ”を確認」「出来高の勢い(Z)」をオンにし、閾値を調整。
背景ハイライトの**閾値(ヒスト/平均線別)**を設定すると、重要局面を一目で把握可能。
スクリーナー利用時は「スクリーナー用」をオンにして、テーブル/ラベルの描画を抑制。
主な入力項目
比較設定:比較シンボル、計算タイムフレーム。
期間・平滑化:比較期間lookback、平滑化長smoothLen、MA種別(EMA/SMA)。
強さ検出(価格):Zスコア方式のオン/オフ、zLen、zThresh。
出来高の質・勢い:質の閾値vqThresh、勢いZの長さvZlenと閾値vZth。
表示:テーブル、背景、ヒスト濃淡、直近ラベルのON/OFF。
背景(閾値):ヒスト/平均線の上下しきいと背景色。
スクリーナー出力:描画抑制トグル。
出力と色分け
ヒストグラム:相対パフォーマンス(%pt)。プラス域は赤系、マイナス域は緑系で濃淡表示。
白線(実体は平滑化相対):上向きかつ出来高質が閾値以上なら赤、上向きでも質不足なら黄、下降時は白。
背景色(任意):設定したヒスト/平均線の閾値を超過/割れで自動着色。
カウンタ:ヒスト/平均線が各閾値を連続超過/連続割れした本数を、スクリーナーが取得できるよう非表示プロットで出力。
シグナル・アラート
強さ検出(価格+出来高):
価格条件 … 平滑化線の0越え、またはZスコアがzThresh越え。
出来高条件 … 「質 ≥ vqThresh」「勢いZ ≥ vZth」(任意)。
条件一致で「強」アラート/喪失・未達で「弱」アラート。
ラベル(任意):確定足でのみ出力。
リペイントと制約
request.security()は確定足データを用い、確定時ラベルのみ描画する設計です。
比較シンボルの更新周期・分足集計差により、短期足ではタイムラグが生じる場合があります。
出来高の「質」は上昇/下降バーの単純仕分けに依存するため、ギャップや出来高の歪みが強い市場では解釈に注意。
閾値は銘柄・期間で最適値が異なります。**過度な最適化(カーブフィット)**は避けてください。
(公開ガイドライン上も、明確で誤解を生む表現の回避が推奨されます。
TradingView
)
活用アイデア(例)
相対優位×出来高質の改善が同時に起きた局面を抽出。
連続超過カウントで、相対の“粘り”や“伸び”をスクリーニング。
指数だけでなく、業種ETFやセクター指数を比較軸にしてローテーション把握。
免責
本スクリプトおよび説明は情報提供・教育目的です。投資助言・勧誘ではありません。市場リスク、流動性、スリッページ、データ仕様に起因する差異等は利用者の自己責任でご確認ください。TradingViewのハウスルール(広告禁止・独自性・言語一致・わかりやすさ)および公開ルールに準拠する形で記述しています。
Release Notes
add Hi lineOpen-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.