OPEN-SOURCE SCRIPT

RSI + TSI Normalized v4

596
============================================================================
RSI + TSI Normalized v4 — Script Overview
============================================================================

── English ─────────────────────────────────────────────────────────────────

PURPOSE
This indicator unifies RSI and TSI (True Strength Index) into a single
oscillator pane by normalizing both to a common ±50 scale centered on zero.
It then derives a weighted composite line from four components (RSI, RSI-MA,
TSI, TSI Signal) and draws an adaptive linear regression channel on that
composite — similar to the Adaptive Trend Finder concept, but applied to
momentum space rather than price.

CORE COMPONENTS
1. RSI (Normalized) — standard RSI shifted so that 50 → 0
2. RSI-MA (EMA of RSI) — smoothed RSI, drawable with user-defined offset
3. TSI — double-smoothed momentum, normalized to ±50
4. TSI Signal (EMA of TSI)— smoothed TSI, drawable with user-defined offset
5. Composite Line — weighted average of (1)–(4), scaled by a
user coefficient (0.5–1.5)
6. Regression Channel — straight-line linear regression on the composite,
with ±σ deviation bands, R² color coding,
and optional history overlay

OFFSET SYSTEM
RSI-MA and TSI Signal can each be shifted left or right (±20 bars).
All crossover detections between offset lines and non-offset lines
(composite, RSI, TSI) use a "visual crossover" algorithm that compares
values at the same *drawing* X-coordinate, not the same bar_index.
This ensures markers appear exactly where lines visually intersect.

CROSSOVER SIGNALS
③ RSI × RSI-MA — basic RSI momentum cross (hidden by default)
④ RSI × TSI — inter-indicator cross (hidden by default)
TSI Signal × RSI — diamond markers (hidden by default)
RSIMA × TSI Signal — offset-aware cross (hidden by default)
⑤ RSIMA × Composite — triangle markers, shown by default
⑥ TSI Signal × Composite — circle markers, shown by default

REGRESSION CHANNEL
Computed via manual least-squares on the composite over a configurable
lookback period. Recalculated every N bars. R² is displayed as a label
at the channel's right edge. Channel color intensity adapts to R²:
high R² = vivid blue/teal (strong trend), low R² = gray (noisy).
Past channels are preserved as dotted gray lines for trend history.

DASHBOARD TABLE
Top-right table shows real-time values: RSI, RSI-MA, TSI, TSI Signal,
MA–Signal spread, offset settings, composite value, and R².

ALERTS
JSON-formatted alertconditions for all crossover types, ready for
webhook integration.

── 日本語 ──────────────────────────────────────────────────────────────────

目的
RSI と TSI(True Strength Index)を共通の ±50 スケールに正規化し、
1つのオシレーターペインに統合するインジケーター。
4つの構成要素(RSI, RSI-MA, TSI, TSI Signal)の加重平均から合成値を算出し、
その合成値に対して Adaptive Trend Finder 風の直線回帰チャネルを描画する。
価格ではなく「モメンタム空間」にチャネル分析を適用するのが特徴。

主要コンポーネント
1. RSI(正規化) — 標準RSIを50=0基準にシフト
2. RSI-MA(RSIのEMA) — 平滑化RSI。ユーザー指定のオフセットで左右シフト可能
3. TSI — 二重平滑化モメンタム。±50に正規化
4. TSI Signal(TSIのEMA)— 平滑化TSI。ユーザー指定のオフセットで左右シフト可能
5. 合成値ライン — (1)〜(4)の加重平均 × ユーザー係数(0.5〜1.5)
6. 回帰チャネル — 合成値に対する直線回帰。±σ偏差バンド、
R²に応じた色変化、過去チャネルの履歴表示

オフセットシステム
RSI-MA と TSI Signal はそれぞれ ±20本の描画シフトが可能。
オフセット付きラインと非オフセットライン(合成値等)のクロス判定は、
「描画上の同じX座標」でのY値を比較する方式を採用。
マーカーは視覚的な交差点に正確に表示される。

クロスシグナル
③ RSI × RSI-MA — RSIモメンタムの基本クロス(デフォルト非表示)
④ RSI × TSI — 異種指標間クロス(デフォルト非表示)
TSI Signal × RSI — ダイヤモンドマーカー(デフォルト非表示)
RSIMA × TSI Signal — オフセット対応クロス(デフォルト非表示)
⑤ RSIMA × 合成値 — 三角マーカー(デフォルト表示)
⑥ TSI Signal × 合成値 — 丸マーカー(デフォルト表示)

回帰チャネル
合成値に対して最小二乗法で傾き・切片を算出し、line.new()で直線描画。
N本ごとに再計算。R²をチャネル右端にラベル表示。
R²が高い=鮮やかな青/緑(明確なトレンド)、低い=灰色(ノイズ)。
過去チャネルは灰色ドット線で残り、トレンド推移を確認可能。

ダッシュボードテーブル
右上にリアルタイム値を表示: RSI, RSI-MA, TSI, TSI Signal,
MA-Signal差, オフセット設定, 合成値, R²。

アラート
全クロスタイプのJSON形式alertconditionを搭載。Webhook連携対応。

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.