OPEN-SOURCE SCRIPT

Macro Risk On/Off Sentiment

By ichimokucorner
Updated
Overview
As an Ichimoku trader, I've always found it crucial to understand the broader market sentiment before entering trades. That's why I developed this Macro Risk On/Off Sentiment Indicator. It's designed to provide a comprehensive view of global market risk sentiment by analysing multiple factors across different asset classes. By combining nine key market indicators, it produces an overall risk sentiment score, giving me a clearer picture of the market's mood before I apply my Ichimoku strategy.

Rationale
While Ichimoku is powerful for identifying trends and potential entry points, I realised it doesn't always capture the broader market context. Markets don't exist in isolation—they're influenced by a myriad of factors including volatility, economic indicators, and cross-asset relationships. By creating this indicator, I aimed to fill that gap, providing myself with a macro view that complements my Ichimoku analysis.

How It Works
The indicator analyses nine different market factors:

  • VIX (Volatility Index): Measures market expectations of near-term volatility.
  • S&P 500 Performance: Represents the overall US stock market performance.
  • US 10-Year Treasury Yield: Indicates bond market sentiment and economic outlook.
  • Gold Price Movement: Often seen as a safe-haven asset.
  • US Dollar Index: Measures the strength of the USD against a basket of currencies.
  • Emerging Markets Performance: Represents risk appetite for higher-risk markets.
  • High Yield Bond Spreads: Indicates credit market risk sentiment.
  • Copper/Gold Ratio: An economic growth indicator.
  • Put/Call Ratio: Measures overall market sentiment based on options trading.


Each factor is assigned a score based on its z-score relative to its recent history, then weighted according to its perceived importance. The overall risk score is a weighted average of these individual scores.

How I Use It
Before applying my Ichimoku strategy, I first check this indicator to gauge the overall market sentiment:

  • I look at the blue line plotted on the chart, which represents the overall risk score.
  • I note the background colour: green for risk-on (positive score) and red for risk-off (negative score).
  • I check the label in the lower-left corner, which provides specific FX pair recommendations and market expectations.


In a risk-on environment (positive score):

  • I focus on long positions in AUD/JPY, NZD/JPY, EUR/USD, etc.
  • I look for short opportunities in USD/CAD, USD/NOK, etc.
  • I expect commodities and yields to rise


In a risk-off environment (negative score):

  • I focus on long positions in USD/JPY, USD/CHF, USD/CAD
  • I look for short opportunities in AUD/USD, NZD/USD, EUR/USD
  • I expect increased volatility and falling yields


The strength of the sentiment is reflected in how close the score is to either 1 (strong risk-on) or -1 (strong risk-off). This helps me gauge how aggressive or conservative I should be with my Ichimoku trades.

Customisation
I've designed this indicator to be flexible. You can modify it to:

  • Adjust the lookback period and moving average length (both default to 30)
  • Change the weighting of different factors in the final score calculation
  • Include or exclude specific factors based on your analysis needs


By combining this Macro Risk On/Off Sentiment Indicator with my Ichimoku analysis, I've found I can make more informed trading decisions, taking into account both the technical setups I see on the chart and the broader market context.
Release Notes
New version removes the old educational labels which cluttered the script and replaces them with a real-time correlation score of the macro risk index vs the current symbol. A correlation of 1 means the symbol is moving in the same direction and proportion to the risk index, and a correlation of -1 means the opposite.

Interestingly, the correlation score validates the earlier instructions that the macro risk score is positively correlated to equities and negatively correlated to safe havens.
Breadth IndicatorsForexFundamental AnalysismacroriskriskoffriskonsentimentalanalysisStocksTrend Analysis
ichimokucorner

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer