OPEN-SOURCE SCRIPT

DXY/XAU Volatility Mismatch & Retracement

913
Here is a complete Pine Script (Version 5) custom-built to execute the exact logic you described. It operates as a state machine that mathematically quantifies the "massive push" in the DXY, checks for the "sideways and low volume" anomaly on Gold (XAU/USD), and waits for the DXY retracement to fire the signal.

How the Logic Works:
DXY Impulse Detection (The Massive Push): The script fetches data from the DXY ticker and calculates its Average True Range (ATR). It measures the DXY's momentum over the last few bars and normalizes it against the ATR. If the move is excessively large, it triggers the first condition.

Gold Compression Filter (Low Volume / Sideways): Simultaneously, the script checks the primary chart (Gold). It requires the Average Directional Index (ADX) to be below 20 (indicating no trend) and the Relative Volume (RVol) to be below 0.70 (indicating low volume exhaustion).

The Pullback Trigger: Once the mismatch is locked in (State = Armed), the script stops looking for expansion and waits for the DXY to retrace. This is detected using a MACD cross-under or a price break below a short-term moving average on the DXY. The moment the DXY corrects, the indicator fires a BUY signal on your Gold chart.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.