OPEN-SOURCE SCRIPT
DXY vs GOLD Equilibrium Oscillator

This script builds a relative-value oscillator between:
DXY = US Dollar Index
Gold = XAUUSD
Since Gold and DXY often move inversely, the script tries to measure whether:
Gold is acting too strong relative to DXY
Gold is acting too weak relative to DXY
Or both are in a more balanced “equilibrium”
It does not predict price by itself.
It is a context / bias tool.
Think of it like this:
If Gold is much stronger than where DXY suggests it “should” be, the oscillator rises
If Gold is much weaker than where DXY suggests it “should” be, the oscillator falls
So the script is essentially asking:
“Compared to the dollar, is gold stretched high, stretched low, or near fair value?”
The script converts both DXY and Gold into a normalized score from 0 to 100 based on their own recent 100-bar range.
Example:
If over the last 100 candles:
Gold’s lowest price = 3000
Gold’s highest price = 3100
Current price = 3075
Then Gold is near the upper part of its recent range, so its normalized value might be around 75.
The same happens for DXY.
Why do this?
Because DXY and Gold trade at completely different price scales.
DXY might be around 100
Gold might be around 3200
You can’t compare raw prices directly.
DXY = US Dollar Index
Gold = XAUUSD
Since Gold and DXY often move inversely, the script tries to measure whether:
Gold is acting too strong relative to DXY
Gold is acting too weak relative to DXY
Or both are in a more balanced “equilibrium”
It does not predict price by itself.
It is a context / bias tool.
Think of it like this:
If Gold is much stronger than where DXY suggests it “should” be, the oscillator rises
If Gold is much weaker than where DXY suggests it “should” be, the oscillator falls
So the script is essentially asking:
“Compared to the dollar, is gold stretched high, stretched low, or near fair value?”
The script converts both DXY and Gold into a normalized score from 0 to 100 based on their own recent 100-bar range.
Example:
If over the last 100 candles:
Gold’s lowest price = 3000
Gold’s highest price = 3100
Current price = 3075
Then Gold is near the upper part of its recent range, so its normalized value might be around 75.
The same happens for DXY.
Why do this?
Because DXY and Gold trade at completely different price scales.
DXY might be around 100
Gold might be around 3200
You can’t compare raw prices directly.
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.