OPEN-SOURCE SCRIPT

Interference Z-Score [G2]

534
Interference Z-Score [G2]
This is the foundational Inter-metric component of the ET Massif Framework research suite.

Description
G2 measures the statistical deviation between two input series using a Z-score transformation. Unlike conventional Z-score indicators that operate on price to derive statistical bands or overbought/oversold conditions, G2 is designed to compare the relative behavior of two independent metrics. The output represents how unusually one input diverges from the other, normalized over a rolling window.syot kilat
Construct
Rather than measuring the raw numerical difference between two sources, G2 measures the angular divergence. G2 operates in three stages:
  1. Difference Calculation
    For each input, the difference is calculated against its value over a specified lookback period.
  2. Geometric Normalization
    The differential is transformed into angular space via the arctangent function, compressing magnitude and normalizing slope behavior.
    Pine Script®
  3. Statistical Normalization (Z-Score)
    The angular spread between the two sources is first determined and then normalized against its own historical distribution. The output reflects the Z-score of that deviation.
    Pine Script®
syot kilatAbove: the Z-Score between two moving averages

Rationale
Market behavior often reflects interactions between multiple dimensions rather than isolated variables. The core utility of G2 is comparing the relative strength, dominance, or alignment of varying metrics that operate on entirely different scales. The indicator exists to quantify:
  • Relative dominance between two metrics
  • Alignment vs divergence
  • Underlying imbalance between inputs
For example, comparing momentum with volume directly is not meaningful due to differences in scale. G2 transforms both into a normalized comparative space, allowing divergence, convergence, and confirmation to be observed clearly.
syot kilatThe Z-Score between price and RSI (for illustrative purposes only)

How to Use
Whilst G2 can take any input as source, it is not intended for price-based statistical banding or threshold analysis. It is primarily designed for indicator-to-indicator comparison, where each input represents a distinct market dimension.

To use another indicator's data, add the indicators to your chart (e.g., RSI and your custom script). Then, in the Settings Inputs tab, select source from the dropdown list. You will now see the plots of any indicator on your chart listed as options.
Source = base or primary metric
Source2 = comparator metric

Example Use Cases
  • Volatility measure vs Acceleration metric
    Identifies whether expansion is structurally supported or becoming unstable.syot kilat
  • Momentum vs Volume-adjusted momentum
    Evaluates whether directional movement is supported by participation. syot kilat
  • Fast vs. Slow moving averages
    Analyzes the interaction between short-term momentum and long-term trend. syot kilat Note: All indicators in the charts shown above used for Z-Score comparisons are generic and used for illustrative purposes only.
Interpretation:
  • Z > 0 → comparator (Source2) is dominating
  • Z < 0 → base (Source) is dominating
  • △Z → rate of divergence or convergence
Important Notes
  • Interference Z-Score [G2] is a diagnostic tool, not a signal generator
  • It does not produce entry or exit conditions
  • It should be interpreted in the context of its input components
Default settings
Source: close
Source2: ohlc4 
Slope period: 5
Z-Score lookback: 20
Smoothing (EMA): 3

日本語概要 (Japanese Summary)
G2は、単なる価格の乖離ではなく、2つのインジケーター間の「軌道のズレ」をZスコアで可視化する高度な分析ツールです。異なるスケールを持つ指標同士を正規化し、その相対的な挙動やモメンタムの勢いを統計的に評価します。主な用途:
  • 指標間の整合性(アラインメント)の確認: 2つのデータソースが同期して動いているかを測定します。
  • ダイバージェンス(背離)の早期検出: 軌道の不一致から市場構造の変化を察知します。
  • 内部構造のストレス評価: 統計的な「行き過ぎ」を数値化し、反転の可能性を示唆します。
※本ツールは直接的な売買シグナルを生成するものではなく、相場の質を判断するための補助的な環境認識ツールとして設計されています。

中文概要 (Chinese Summary)
G2 是一款專為衡量兩個指標之間「動量軌跡」與「統計偏差(Z-Score)」而設計的進階分析工具。與傳統僅測量價格偏差的 Z-Score 不同,G2 的核心價值在於標準化不同維度指標之間的相對關係,將其轉化為可比較的統計單位。核心功能與用途:
  • 指標連動性(Alignment)判定: 量化兩個指標是否同步運作,確認市場共識的強弱。
  • 結構性背離偵測: 當指標軌跡出現統計上的極端偏離時,預警潛在的趨勢反轉或動量衰竭。
  • 異質指標相對強度分析: 將不同尺度(Scale)的指標進行標準化處理,以便在同一基準下評估其相對表現。
  • 系統內部壓力評估: 透過 Z-Score 的斜率變化,觀察市場內在動能是否處於過度拉伸的「壓力區」。
分析建議:
本工具定位為「輔助環境辨識指標」,主要用於優化交易邏輯與過濾訊號,並非直接產生買賣點的訊號產生器。建議搭配趨勢指標使用,以確認市場結構是否發生本質性的改變。

Disclaimer
This script is intended for research and educational purposes only.
It does not constitute financial advice. Trading involves risk.

Penafian

Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.