Introduction

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.

Method

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 Nasdaq Data Link.

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

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(self.gold, 0.9)
    else:
        self.Liquidate()

Custom Charting

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

def Initialize(self):
    yieldPlot = Chart("Yield Plot")
    yieldPlot.AddSeries(Series("BondYield", SeriesType.Line, 0))
    yieldPlot.AddSeries(Series("EarningsYield", SeriesType.Line, 0))
    self.AddChart(yieldPlot)

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)


Reference

  1. Quantpedia Premium - Gold Market Timing

Author