OPEN-SOURCE SCRIPT
Gold Mining Margin MACRO

Gold Mining Margin Macro Indicator — Description
This indicator measures the structural profitability of gold mining by comparing the gold price with estimated production costs. It is designed as a macro-context tool, not a short-term trading signal.
The script tracks three core components:
Gold − AISC (All-In Sustaining Cost) → proxy for mining profitability
Energy-adjusted mining margin → incorporates oil as a major production cost input
Gold / Oil ratio → intermarket relationship between gold and energy costs
Together, these metrics help visualize the economic pressure or expansion phase of the gold mining sector.
What the indicator measures
The indicator estimates whether gold is trading:
near production-cost pressure levels
in a neutral profitability zone
in a strong mining-profit environment
or in a boom phase
A weekly regime classification is used to reduce noise and focus on macro-cycle conditions rather than short-term price fluctuations.
Primary use case
This indicator is intended to help identify:
potential gold price floor zones
mining-sector stress conditions
cyclical turning points in gold
confirmation context for cycle-based analysis
It works best when combined with:
cycle analysis
intermarket analysis
positioning data
macroeconomic context
Important note
The AISC value is user-defined and represents an approximate global industry cost level, not the cost of a specific mining company.
The indicator is meant to reflect sector-level economics, not individual equities.
This indicator measures the structural profitability of gold mining by comparing the gold price with estimated production costs. It is designed as a macro-context tool, not a short-term trading signal.
The script tracks three core components:
Gold − AISC (All-In Sustaining Cost) → proxy for mining profitability
Energy-adjusted mining margin → incorporates oil as a major production cost input
Gold / Oil ratio → intermarket relationship between gold and energy costs
Together, these metrics help visualize the economic pressure or expansion phase of the gold mining sector.
What the indicator measures
The indicator estimates whether gold is trading:
near production-cost pressure levels
in a neutral profitability zone
in a strong mining-profit environment
or in a boom phase
A weekly regime classification is used to reduce noise and focus on macro-cycle conditions rather than short-term price fluctuations.
Primary use case
This indicator is intended to help identify:
potential gold price floor zones
mining-sector stress conditions
cyclical turning points in gold
confirmation context for cycle-based analysis
It works best when combined with:
cycle analysis
intermarket analysis
positioning data
macroeconomic context
Important note
The AISC value is user-defined and represents an approximate global industry cost level, not the cost of a specific mining company.
The indicator is meant to reflect sector-level economics, not individual equities.
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.