Strategy Library

Gold Market Timing


Gold plays an essential role as a diversifier due to its low or negative correlation to other asset classes. We explore "The Fed Model," a theory that bonds can be used to judge whether the U.S. stock market is fairly valued and use this to determine entry and exit points for gold.


Fed Model

Historically, the S&P 500 earning yield has a strong correlation with the 10-year Treasury note. There is the theory that if the forward earnings yield of the S&P 500 is higher than the 10-year government bond yield, stocks are undervalued and vice versa.

We import the custom fundamental data of government 10-year bond yield and S&P 500 earnings yield from Quandl.

# United States Government 10-Year Bond Yield
self.bond_yield = "YC/USA10Y"
# S&P 500 Earnings Yield. Earnings Yield = trailing 12 month earnings divided by index price
self.earnings_yield = "MULTPL/SP500_EARNINGS_YIELD_MONTH"
# Gold Prices (Daily) - Currency USD (All values are national currency units per troy ounce) = "WGC/GOLD_DAILY_USD"
# Add custom quandl data
self.AddData(QuandlRate, self.bond_yield, Resolution.Daily, DateTimeZone.Utc, True)
self.AddData(QuandlValue, self.earnings_yield, Resolution.Daily, DateTimeZone.Utc, True)
self.AddData(QuandlValue,, Resolution.Daily, DateTimeZone.Utc, True)

Gold Investment

With gold having a strong negative correlation to equity valuations, then gold prices will rise along with earnings yield, bond yield, and inflation. Taking the above relationship a step further, this algorithm goes long gold when the Fed model shows the market undervalued otherwise liquidate the portfolio. The undervalued market is defined as the earning yield is higher than the bond yield and their ratio is at least 2. Rebalancing is done on a monthly basis.

def Rebalance(self):
    if self.Securities[self.earnings_yield].Price == 0 or self.Securities[self.bond_yield].Price == 0: return
    # Buy gold if E/P is higher than the bond yield and their ratio is at least 2
    if self.Securities[self.earnings_yield].Price > self.Securities[self.bond_yield].Price * Decimal(2):
        self.SetHoldings(, 0.9)

Custom Charting

To demonstrate the relationship between government 10-year bond yield and S&P 500 earnings yield, we plot the two series in equity chart.

def Initialize(self):
    yieldPlot = Chart("Yield Plot")
    yieldPlot.AddSeries(Series("BondYield", SeriesType.Line, 0))
    yieldPlot.AddSeries(Series("EarningsYield", SeriesType.Line, 0))
def OnData(self, data):
    if data.ContainsKey(self.bond_yield) and data.ContainsKey(self.earnings_yield):
        self.Plot("Yield Plot", "BondYield", data[self.bond_yield].Price)
        self.Plot("Yield Plot", "EarningsYield", data[self.earnings_yield].Price)


You can also see our Documentation and Videos. You can also get in touch with us via Chat.

Did you find this page Helpful ?