OPEN-SOURCE SCRIPT
DXY/XAU Volatility Mismatch & Retracement

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.
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.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.