OPEN-SOURCE SCRIPT
Credit Spread Regime

The Credit Market as Economic Barometer
Credit spreads are among the most reliable leading indicators of economic stress. When corporations borrow money by issuing bonds, investors demand a premium above the risk-free Treasury rate to compensate for the possibility of default. This premium, known as the credit spread, fluctuates based on perceptions of economic health, corporate profitability, and systemic risk.
The relationship between credit spreads and economic activity has been studied extensively. Two papers form the foundation of this indicator. Pierre Collin-Dufresne, Robert Goldstein, and Spencer Martin published their influential 2001 paper in the Journal of Finance, documenting that credit spread changes are driven by factors beyond firm-specific credit quality. They found that a substantial portion of spread variation is explained by market-wide factors, suggesting credit spreads contain information about aggregate economic conditions.
Simon Gilchrist and Egon Zakrajsek extended this research in their 2012 American Economic Review paper, introducing the concept of the Excess Bond Premium. They demonstrated that the component of credit spreads not explained by default risk alone is a powerful predictor of future economic activity. Elevated excess spreads precede recessions with remarkable consistency.
What Credit Spreads Reveal
Credit spreads measure the difference in yield between corporate bonds and Treasury securities of similar maturity. High yield bonds, also called junk bonds, carry ratings below investment grade and offer higher yields to compensate for greater default risk. Investment grade bonds have lower yields because the probability of default is smaller.
The spread between high yield and investment grade bonds is particularly informative. When this spread widens, investors are demanding significantly more compensation for taking on credit risk. This typically indicates deteriorating economic expectations, tighter financial conditions, or increasing risk aversion. When the spread narrows, investors are comfortable accepting lower premiums, signaling confidence in corporate health.
The Gilchrist-Zakrajsek research showed that credit spreads contain two distinct components. The first is the expected default component, which reflects the probability-weighted cost of potential defaults based on corporate fundamentals. The second is the excess bond premium, which captures additional compensation demanded beyond expected defaults. This excess premium rises when investor risk appetite declines and financial conditions tighten.
The Implementation Approach
This indicator uses actual option-adjusted spread data from the Federal Reserve Economic Database (FRED), available directly in TradingView. The ICE BofA indices represent the industry standard for measuring corporate bond spreads.
The primary data sources are FRED:BAMLH0A0HYM2, the ICE BofA US High Yield Index Option-Adjusted Spread, and FRED:BAMLC0A0CM, the ICE BofA US Corporate Index Option-Adjusted Spread for investment grade bonds. These indices measure the spread of corporate bonds over Treasury securities of similar duration, expressed in basis points.
Option-adjusted spreads account for embedded options in corporate bonds, providing a cleaner measure of credit risk than simple yield spreads. The methodology developed by ICE BofA is widely used by institutional investors and central banks for monitoring credit conditions.
The indicator offers two modes. The HY-IG excess spread mode calculates the difference between high yield and investment grade spreads, isolating the pure compensation for below-investment-grade credit risk. This measure is less affected by broad interest rate movements. The HY-only mode tracks the absolute high yield spread, capturing both credit risk and the overall level of risk premiums in the market.
Interpreting the Regimes
Credit conditions are classified into four regimes based on Z-scores calculated from the spread proxy.
The Stress regime occurs when spreads reach extreme levels, typically above a Z-score of 2.0. At this point, credit markets are pricing in significant default risk and economic deterioration. Historically, stress regimes have coincided with recessions, financial crises, and major market dislocations. The 2008 financial crisis, the 2011 European debt crisis, the 2016 commodity collapse, and the 2020 pandemic all triggered credit stress regimes.
The Elevated regime, between Z-scores of 1.0 and 2.0, indicates above-normal risk premiums. Credit conditions are tightening. This often occurs in the build-up to stress events or during periods of uncertainty. Risk management should be heightened, and exposure to credit-sensitive assets may be reduced.
The Normal regime covers Z-scores between -1.0 and 1.0. This represents typical credit conditions where spreads fluctuate around historical averages. Standard investment approaches are appropriate.
The Low regime occurs when spreads are compressed below a Z-score of -1.0. Investors are accepting below-average compensation for credit risk. This can indicate complacency, strong economic confidence, or excessive risk-taking. While often associated with favorable conditions, extremely tight spreads sometimes precede sudden reversals.
Credit Cycle Dynamics
Beyond static regime classification, the indicator tracks the direction and acceleration of spread movements. This reveals where credit markets stand in the credit cycle.
The Deteriorating phase occurs when spreads are elevated and continuing to widen. Credit conditions are actively worsening. This phase often precedes or coincides with economic downturns.
The Recovering phase occurs when spreads are elevated but beginning to narrow. The worst may be over. Credit conditions are improving from stressed levels. This phase often accompanies the early stages of economic recovery.
The Tightening phase occurs when spreads are low and continuing to compress. Credit conditions are very favorable and improving further. This typically occurs during strong economic expansions but may signal building complacency.
The Loosening phase occurs when spreads are low but beginning to widen from compressed levels. The extremely favorable conditions may be normalizing. This can be an early warning of changing sentiment.
Relationship to Economic Activity
The predictive power of credit spreads for economic activity is well-documented. Gilchrist and Zakrajsek found that the excess bond premium predicts GDP growth, industrial production, and unemployment rates over horizons of one to four quarters.
When credit spreads spike, the cost of corporate borrowing increases. Companies may delay or cancel investment projects. Reduced investment leads to slower growth and eventually higher unemployment. The transmission mechanism runs from financial conditions to real economic activity.
Conversely, tight credit spreads lower borrowing costs and encourage investment. Easy credit conditions support economic expansion. However, excessively tight spreads may encourage over-leveraging, planting seeds for future stress.
Practical Application
For equity investors, credit spreads provide context for market risk. Equities and credit often move together because both reflect corporate health. Rising credit spreads typically accompany falling stock prices. Extremely wide spreads historically have coincided with equity market bottoms, though timing the reversal remains challenging.
For fixed income investors, spread regimes guide sector allocation decisions. During stress regimes, flight to quality favors Treasuries over corporates. During low regimes, spread compression may offer limited additional return for credit risk, suggesting caution on high yield.
For macro traders, credit spreads complement other indicators of financial conditions. Credit stress often leads equity volatility, providing an early warning signal. Cross-asset strategies may use credit regime as a filter for position sizing.
Limitations and Considerations
FRED data updates with a lag, typically one business day for the ICE BofA indices. For intraday trading decisions, more current proxies may be necessary. The data is most reliable on daily timeframes.
Credit spreads can remain at extreme levels for extended periods. Mean reversion signals indicate elevated probability of normalization but do not guarantee timing. The 2008 crisis saw spreads remain elevated for many months before normalizing.
The indicator is calibrated for US credit markets. Application to other regions would require different data sources such as European or Asian credit indices. The relationship between spreads and subsequent economic activity may vary across market cycles and structural regimes.
References
Collin-Dufresne, P., Goldstein, R.S., and Martin, J.S. (2001). The Determinants of Credit Spread Changes. Journal of Finance, 56(6), 2177-2207.
Gilchrist, S., and Zakrajsek, E. (2012). Credit Spreads and Business Cycle Fluctuations. American Economic Review, 102(4), 1692-1720.
Krishnamurthy, A., and Muir, T. (2017). How Credit Cycles across a Financial Crisis. Working Paper, Stanford University.
Credit spreads are among the most reliable leading indicators of economic stress. When corporations borrow money by issuing bonds, investors demand a premium above the risk-free Treasury rate to compensate for the possibility of default. This premium, known as the credit spread, fluctuates based on perceptions of economic health, corporate profitability, and systemic risk.
The relationship between credit spreads and economic activity has been studied extensively. Two papers form the foundation of this indicator. Pierre Collin-Dufresne, Robert Goldstein, and Spencer Martin published their influential 2001 paper in the Journal of Finance, documenting that credit spread changes are driven by factors beyond firm-specific credit quality. They found that a substantial portion of spread variation is explained by market-wide factors, suggesting credit spreads contain information about aggregate economic conditions.
Simon Gilchrist and Egon Zakrajsek extended this research in their 2012 American Economic Review paper, introducing the concept of the Excess Bond Premium. They demonstrated that the component of credit spreads not explained by default risk alone is a powerful predictor of future economic activity. Elevated excess spreads precede recessions with remarkable consistency.
What Credit Spreads Reveal
Credit spreads measure the difference in yield between corporate bonds and Treasury securities of similar maturity. High yield bonds, also called junk bonds, carry ratings below investment grade and offer higher yields to compensate for greater default risk. Investment grade bonds have lower yields because the probability of default is smaller.
The spread between high yield and investment grade bonds is particularly informative. When this spread widens, investors are demanding significantly more compensation for taking on credit risk. This typically indicates deteriorating economic expectations, tighter financial conditions, or increasing risk aversion. When the spread narrows, investors are comfortable accepting lower premiums, signaling confidence in corporate health.
The Gilchrist-Zakrajsek research showed that credit spreads contain two distinct components. The first is the expected default component, which reflects the probability-weighted cost of potential defaults based on corporate fundamentals. The second is the excess bond premium, which captures additional compensation demanded beyond expected defaults. This excess premium rises when investor risk appetite declines and financial conditions tighten.
The Implementation Approach
This indicator uses actual option-adjusted spread data from the Federal Reserve Economic Database (FRED), available directly in TradingView. The ICE BofA indices represent the industry standard for measuring corporate bond spreads.
The primary data sources are FRED:BAMLH0A0HYM2, the ICE BofA US High Yield Index Option-Adjusted Spread, and FRED:BAMLC0A0CM, the ICE BofA US Corporate Index Option-Adjusted Spread for investment grade bonds. These indices measure the spread of corporate bonds over Treasury securities of similar duration, expressed in basis points.
Option-adjusted spreads account for embedded options in corporate bonds, providing a cleaner measure of credit risk than simple yield spreads. The methodology developed by ICE BofA is widely used by institutional investors and central banks for monitoring credit conditions.
The indicator offers two modes. The HY-IG excess spread mode calculates the difference between high yield and investment grade spreads, isolating the pure compensation for below-investment-grade credit risk. This measure is less affected by broad interest rate movements. The HY-only mode tracks the absolute high yield spread, capturing both credit risk and the overall level of risk premiums in the market.
Interpreting the Regimes
Credit conditions are classified into four regimes based on Z-scores calculated from the spread proxy.
The Stress regime occurs when spreads reach extreme levels, typically above a Z-score of 2.0. At this point, credit markets are pricing in significant default risk and economic deterioration. Historically, stress regimes have coincided with recessions, financial crises, and major market dislocations. The 2008 financial crisis, the 2011 European debt crisis, the 2016 commodity collapse, and the 2020 pandemic all triggered credit stress regimes.
The Elevated regime, between Z-scores of 1.0 and 2.0, indicates above-normal risk premiums. Credit conditions are tightening. This often occurs in the build-up to stress events or during periods of uncertainty. Risk management should be heightened, and exposure to credit-sensitive assets may be reduced.
The Normal regime covers Z-scores between -1.0 and 1.0. This represents typical credit conditions where spreads fluctuate around historical averages. Standard investment approaches are appropriate.
The Low regime occurs when spreads are compressed below a Z-score of -1.0. Investors are accepting below-average compensation for credit risk. This can indicate complacency, strong economic confidence, or excessive risk-taking. While often associated with favorable conditions, extremely tight spreads sometimes precede sudden reversals.
Credit Cycle Dynamics
Beyond static regime classification, the indicator tracks the direction and acceleration of spread movements. This reveals where credit markets stand in the credit cycle.
The Deteriorating phase occurs when spreads are elevated and continuing to widen. Credit conditions are actively worsening. This phase often precedes or coincides with economic downturns.
The Recovering phase occurs when spreads are elevated but beginning to narrow. The worst may be over. Credit conditions are improving from stressed levels. This phase often accompanies the early stages of economic recovery.
The Tightening phase occurs when spreads are low and continuing to compress. Credit conditions are very favorable and improving further. This typically occurs during strong economic expansions but may signal building complacency.
The Loosening phase occurs when spreads are low but beginning to widen from compressed levels. The extremely favorable conditions may be normalizing. This can be an early warning of changing sentiment.
Relationship to Economic Activity
The predictive power of credit spreads for economic activity is well-documented. Gilchrist and Zakrajsek found that the excess bond premium predicts GDP growth, industrial production, and unemployment rates over horizons of one to four quarters.
When credit spreads spike, the cost of corporate borrowing increases. Companies may delay or cancel investment projects. Reduced investment leads to slower growth and eventually higher unemployment. The transmission mechanism runs from financial conditions to real economic activity.
Conversely, tight credit spreads lower borrowing costs and encourage investment. Easy credit conditions support economic expansion. However, excessively tight spreads may encourage over-leveraging, planting seeds for future stress.
Practical Application
For equity investors, credit spreads provide context for market risk. Equities and credit often move together because both reflect corporate health. Rising credit spreads typically accompany falling stock prices. Extremely wide spreads historically have coincided with equity market bottoms, though timing the reversal remains challenging.
For fixed income investors, spread regimes guide sector allocation decisions. During stress regimes, flight to quality favors Treasuries over corporates. During low regimes, spread compression may offer limited additional return for credit risk, suggesting caution on high yield.
For macro traders, credit spreads complement other indicators of financial conditions. Credit stress often leads equity volatility, providing an early warning signal. Cross-asset strategies may use credit regime as a filter for position sizing.
Limitations and Considerations
FRED data updates with a lag, typically one business day for the ICE BofA indices. For intraday trading decisions, more current proxies may be necessary. The data is most reliable on daily timeframes.
Credit spreads can remain at extreme levels for extended periods. Mean reversion signals indicate elevated probability of normalization but do not guarantee timing. The 2008 crisis saw spreads remain elevated for many months before normalizing.
The indicator is calibrated for US credit markets. Application to other regions would require different data sources such as European or Asian credit indices. The relationship between spreads and subsequent economic activity may vary across market cycles and structural regimes.
References
Collin-Dufresne, P., Goldstein, R.S., and Martin, J.S. (2001). The Determinants of Credit Spread Changes. Journal of Finance, 56(6), 2177-2207.
Gilchrist, S., and Zakrajsek, E. (2012). Credit Spreads and Business Cycle Fluctuations. American Economic Review, 102(4), 1692-1720.
Krishnamurthy, A., and Muir, T. (2017). How Credit Cycles across a Financial Crisis. Working Paper, Stanford University.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Where others speculate, we systematize.
edgetools.org
edgetools.org
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Where others speculate, we systematize.
edgetools.org
edgetools.org
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.