OPEN-SOURCE SCRIPT
Gold Macro Projection Model

GOLD MACRO PROJECTION MODEL
Multi-Factor Fair Value Estimation for Gold
OVERVIEW
The Gold Macro Projection Model estimates gold's fair value based on its historical relationships with key macroeconomic drivers. By synthesizing data from silver, M2 money supply, the US Dollar Index, TIPS (real rates proxy), and major equity indices, this indicator projects where gold should theoretically be trading—helping traders identify potential overvaluation and undervaluation conditions.
HOW IT WORKS
This indicator employs three complementary projection methodologies:
INPUT FACTORS
VISUAL ELEMENTS
INFO TABLE
The indicator displays a real-time information panel showing:
SIGNAL INTERPRETATION
SETTINGS
ALERTS
BEST PRACTICES
Disclaimer: This indicator is for educational purposes only. Past correlations do not guarantee future relationships. Always use proper risk management.
Multi-Factor Fair Value Estimation for Gold
OVERVIEW
The Gold Macro Projection Model estimates gold's fair value based on its historical relationships with key macroeconomic drivers. By synthesizing data from silver, M2 money supply, the US Dollar Index, TIPS (real rates proxy), and major equity indices, this indicator projects where gold should theoretically be trading—helping traders identify potential overvaluation and undervaluation conditions.
HOW IT WORKS
This indicator employs three complementary projection methodologies:
- Correlation-Weighted Z-Score Composite (50% weight)
Calculates rolling correlations between gold and each input factor. Factors with stronger correlations receive more influence. Each factor is normalized to a z-score, combined into a composite, then converted back to gold's price scale. - Silver/Gold Ratio Mean Reversion (35% weight)
The silver/gold ratio historically exhibits mean-reverting behavior. This component projects gold's implied price based on current silver prices and the historical average ratio. - M2 Money Supply Relationship (15% weight)
Gold tracks monetary expansion over long time horizons. This anchors the projection to the fundamental relationship between gold and the monetary base.
INPUT FACTORS
- Silver — Strong positive correlation; precious metals move together
- M2 Money Supply — Positive correlation; gold as inflation hedge
- US Dollar Index (DXY) — Typically negative correlation; inverse relationship
- TIPS ETF — Real interest rate proxy; gold responds to real yields
- Equity Indices — Variable correlation; risk-on/risk-off dynamics
VISUAL ELEMENTS
- Yellow Line — Actual gold price
- Aqua Line — Projected fair value
- Green Fill — Gold trading below projection (potentially undervalued)
- Red Fill — Gold trading above projection (potentially overvalued)
- Aqua Bands — Standard deviation envelope around projection
INFO TABLE
The indicator displays a real-time information panel showing:
- Current actual vs. projected price
- Divergence percentage and Z-score
- Rolling correlations for each factor
- Dynamic weight allocation
- Buy/Sell signal based on divergence extremes
SIGNAL INTERPRETATION
- STRONG BUY — Z-score below -2 (extremely undervalued)
- BUY — Z-score between -2 and -1 (moderately undervalued)
- NEUTRAL — Z-score between -1 and +1 (fairly valued)
- SELL — Z-score between +1 and +2 (moderately overvalued)
- STRONG SELL — Z-score above +2 (extremely overvalued)
SETTINGS
- Correlation Period — Lookback for correlation calculations (default: 60)
- Regression Period — Lookback for mean/standard deviation (default: 120)
- Smoothing Period — EMA smoothing for projection line (default: 10)
- Auto Weights — Toggle between correlation-based or manual weights
- Band Multiplier — Standard deviation multiplier for bands (default: 1.5)
ALERTS
- Gold Extremely Undervalued — Z crosses below -2
- Gold Extremely Overvalued — Z crosses above +2
- Gold Crossed Above Projection
- Gold Crossed Below Projection
BEST PRACTICES
- Use on daily timeframe for most reliable signals
- Combine with the companion Gold Divergence Oscillator for timing
Disclaimer: This indicator is for educational purposes only. Past correlations do not guarantee future relationships. Always use proper risk management.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.