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.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.