PROTECTED SOURCE SCRIPT
Z-Score Stat Trading

🔷 Z-Score Stat Trading
Description:
⚠️ This indicator is published for educational purposes only. All responsibility for its use lies solely with the user. It does not constitute financial advice or a trading recommendation.
The Z-Score Stat Trading indicator is a statistical tool designed for pair trading strategies, helping traders identify mean-reversion opportunities between two correlated assets.
This indicator analyzes the log-price spread between two user-defined symbols (e.g., BTCUSDT vs ETHUSDT) and calculates both long-term and short-term Z-Scores to detect overbought and oversold conditions.
📊 Key Features:
Dual Z-Score lines (long-term and short-term) for increased confirmation.
Dynamic correlation tracking between the two assets.
Volatility estimation based on log-return standard deviations.
Visual and alert-based entry signals when Z-Score crosses a customizable threshold.
On-chart table showing real-time correlation, spread, and volatility data.
📈 Strategy Logic:
Z-Score = (spread - mean) / standard deviation
A long signal is triggered when both long and short Z-Scores are below the negative threshold (e.g., -2).
A short signal is triggered when both Z-Scores are above the positive threshold (e.g., +2).
Spread is calculated as the difference between log-prices: log(Symbol A) - log(Symbol B)
This indicator is suitable for traders looking to exploit statistical arbitrage between highly correlated crypto pairs or other assets.
⚙️ Inputs:
Symbol A / Symbol B – The two assets to compare.
Long & Short Z-Score Periods – Defines how many bars are used in each Z-Score.
Correlation Period – Controls the window for calculating the rolling correlation.
Z-Score Threshold – The deviation level required to trigger signals.
Description:
⚠️ This indicator is published for educational purposes only. All responsibility for its use lies solely with the user. It does not constitute financial advice or a trading recommendation.
The Z-Score Stat Trading indicator is a statistical tool designed for pair trading strategies, helping traders identify mean-reversion opportunities between two correlated assets.
This indicator analyzes the log-price spread between two user-defined symbols (e.g., BTCUSDT vs ETHUSDT) and calculates both long-term and short-term Z-Scores to detect overbought and oversold conditions.
📊 Key Features:
Dual Z-Score lines (long-term and short-term) for increased confirmation.
Dynamic correlation tracking between the two assets.
Volatility estimation based on log-return standard deviations.
Visual and alert-based entry signals when Z-Score crosses a customizable threshold.
On-chart table showing real-time correlation, spread, and volatility data.
📈 Strategy Logic:
Z-Score = (spread - mean) / standard deviation
A long signal is triggered when both long and short Z-Scores are below the negative threshold (e.g., -2).
A short signal is triggered when both Z-Scores are above the positive threshold (e.g., +2).
Spread is calculated as the difference between log-prices: log(Symbol A) - log(Symbol B)
This indicator is suitable for traders looking to exploit statistical arbitrage between highly correlated crypto pairs or other assets.
⚙️ Inputs:
Symbol A / Symbol B – The two assets to compare.
Long & Short Z-Score Periods – Defines how many bars are used in each Z-Score.
Correlation Period – Controls the window for calculating the rolling correlation.
Z-Score Threshold – The deviation level required to trigger signals.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.