This indicator takes the ratio of the US average housing market price to the SPX. Then, this number is placed into another ratio over NFCI. The reason for this is because the ratio of House Prices/SPX is closely correlated with the NFCI. So comparing those terms using another ratio is aimed at detecting anomalies in the economy which can be used as a signal. The resulting chart looks like a heartbeat.
When the ratio spikes upward and unemployment has bottomed out, to touch each other, this is the signal that the market may be peaking, or is entering a volatile period. As you can see it performed very well except for the the covid crash, in which the contact occurred after the crash.
Currently the rounded shape of the indicator might, to my surprise, indicate that we are only mid cycle.
//@version=5
indicator("Home Prices Ratio to SPX and NFCI with Unemployment Rate", overlay=false)
// Fetch data from FRED
home_prices = request.security("FRED:CSUSHPINSA", "M", close)
spx = request.security("SPX", "D", close)
nfci = request.security("FRED:NFCI", "W", close)
unemployment_rate = request.security("FRED:UNRATE", "M", close)
// Calculate the ratio
ratio = (home_prices / spx) / nfci
// Apply a median filter to smooth out spikes
smoothed_ratio = ta.median(ratio, 10)
// Calculate the mean and standard deviation for normalization
length = 100
ratio_mean = ta.sma(smoothed_ratio, length)
ratio_stdev = ta.stdev(smoothed_ratio, length)
// Z-score normalization
normalized_ratio = (smoothed_ratio - ratio_mean) / ratio_stdev
// Unemployment rate threshold
unemployment_threshold = 6.0
// Plot the normalized ratio
plot(normalized_ratio, title="Normalized Home Prices Ratio to SPX and NFCI", color=color.blue, linewidth=2)
// Plot the unemployment rate
plot(unemployment_rate, title="Unemployment Rate", color=color.red, linewidth=2)
Leave a Reply