OPEN-SOURCE SCRIPT

Profitable Pair Correlation Divergence Scanner v6

137
This strategy identifies divergence opportunities between two correlated assets using a combination of Z-Score spread analysis, trend confirmation, RSI & MACD momentum checks, correlation filters, and ATR-based stop-loss/take-profit management. It’s optimized for positive P&L and realistic trade execution.

Key Features:
Pair Divergence Detection:
Measures deviation between returns of two assets and identifies overbought/oversold spread conditions using Z-Score.

Trend Alignment:
Trades only in the direction of the primary asset’s trend using a fast EMA vs slow EMA filter.

Momentum Confirmation:
Confirms trades with RSI and MACD to reduce false signals.

Correlation Filter:
Ensures the pair is strongly correlated before taking trades, avoiding noisy signals.

Risk Management:
Dynamic ATR-based stop-loss and take-profit ensures proper reward-to-risk ratio.

Exit Conditions:
Automatically closes positions when Z-Score normalizes, or ATR-based exits are hit.

How It Works:
Calculate Returns:
Computes returns for both assets over the selected timeframe.

Z-Score Spread:
Calculates the spread between returns and normalizes it using moving average and standard deviation.

Trend Filter:
Only takes long trades if the fast EMA is above the slow EMA, and short trades if the fast EMA is below the slow EMA.

Momentum Confirmation:
Confirms trade direction with RSI (>50 for longs, <50 for shorts) and MACD alignment.

Correlation Check:
Ensures the pair’s recent correlation is strong enough to validate divergence signals.

Trade Execution:
Opens positions when Z-Score crosses thresholds and all conditions align. Positions close when Z-Score normalizes or ATR-based SL/TP is hit.

Plot Explanation:
  • Z-Score: Blue line shows divergence magnitude.
  • Entry Levels: Red/Green lines mark long/short thresholds.
  • Exit Zone: Gray lines show normalization zone.
  • EMA Trend Lines: Purple (fast), Orange (slow) for trend alignment.
  • Correlation: Teal overlay shows current correlation strength.

Usage Tips:
  • Use highly correlated pairs for best results (e.g., EURUSD/GBPUSD).
  • Run on higher timeframe charts (1h or 4h) to reduce noise.
  • Adjust ATR multiplier based on volatility to avoid premature stops.
  • Combine with alerts for automated notifications or webhook execution.

Conclusion:
The Profitable Pair Correlation Divergence Scanner v6 is designed for traders who want systematic, low-risk, positive P&L trading opportunities with minimal manual monitoring. By combining trend alignment, momentum confirmation, correlation filters, and dynamic exits, it reduces false signals and improves execution reliability.

Run it on TradingView and watch how it captures divergence opportunities while maintaining positive P&L across trades.

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.