Correlation & Mean Reversion - Paired Stocks/ETFs TradingThis indicator is designed to analyze pair trading opportunities between two assets by evaluating:
🔧 Core Features
1. Symbol Pair Analysis
Takes two input symbols (Symbol A, Symbol B).
Calculates the price ratio (A/B) and compares it to a user-defined targetRatio.
2. Z-Score of Ratio
Computes Z-Score of the ratio over a user-defined lookback window to measure how far the ratio deviates from its mean.
This gauges whether the ratio is likely to revert to the mean.
3. Reversion Probability
Applies a normal CDF approximation to Z-Score to estimate the probability of mean reversion.
Flags moderate (80%+) and strong (95%+) reversion signals.
4. Correlation
Calculates the rolling correlation of log returns between Symbol A and Symbol B.
Useful to confirm if the assets historically move together.