OPEN-SOURCE SCRIPT

CNN Fear and Greed Index JD modified from minusminus

CNN Fear and Greed Index - https://www.cnn.com/markets/fear-and-greed

Modified from minusminus -
CNN Fear and Greed Index


See Documentation from CNN's website
CNN's Fear and Greed index is an attempt to quantitatively score the Fear and Greed in the SPX using 7 factors:
  1. Market Momentum- S&P 500 (SPX) and its 125-day moving average
  2. Stock Price Strength -Net new 52-week highs and lows on the NYSE
  3. Stock Price Breadth - McClellan Volume Summation Index
  4. Put and Call options - 5-day average put/call ratio
  5. Market Volatility - VIX and its 50-day moving average
  6. Safe Haven Demand - Difference in 20-day stock and bond returns
  7. Junk Bond Demand - Yield spread: junk bonds vs. investment grade


Each Factor has a weight input for the final calculation initially set to a weight of 1. The final calculation of the index is a weighted average of each factor.

3 Factors have separate functions for calculation: See Code for Clarity

  1. SPX Momentum: difference between the Daily SPX index value and it's 125 Day Simple moving average.
  2. Stock Price Strength: Net New 52-week highs and lows on the NYSE.
    Function calculates a measure of Net New 52-week highs by:
    NYSE 52-week highs (INDEX:MAHN) - all new NYSE Highs (INDEX:HIGH)
    measure of Net New 52-week lows by:
    NYSE 52-week lows (INDEX:MALN) - all new NYSE Lows (INDEX:LOWN)
    Then calculate a ratio of Net New 52-week Highs and Lows over Total Highs and Lows then takes a 5-day moving average of that ratio-See Code
  3. Stock Price Breadth is the McClellan Volume Summation Index:
    First Calculate the McClellan Oscillator
    Second Calculate the Summation Index


4 Factors are Straight data requests
  1. 5 Day Simple Moving Average of the Put-Call Ratio on SPY
  2. 50 Day Simple Moving Average of the SPX VIX
  3. Difference between 20 Day Simple Moving Average of SPX Daily Close and 20 Day Simple Moving Average of 10Y Constant Maturity US Treasury Note
  4. Yield Spread between ICE BofA US High Yield Index and ICE BofA US Investment Grade Corporate Yield Index


The Fear and Greed Index is a weighted average of these factors - which is then normalized to scale from 0 to 100 using the past 25 values - length parameter.

3 Zones are Shaded: Red for Extreme Fear, Grey for normal jitters, Green for Extreme Greed.

Disclaimer: This is not financial advice. These are just my ideas, and I am not an investment advisor or investment professional. This code is for informational purposes only and do your own analysis before making any investment decisions. This is an attempt to replicate in spirt an index CNN publishes on their website and in no way shape or form infringes on their content, calculations or proprietary information.




From CNN: https://www.cnn.com/markets/fear-and-greed

FEAR & GREED INDEX FAQs
What is the CNN Business Fear & Greed Index?

The Fear & Greed Index is a way to gauge stock market movements and whether stocks are fairly priced. The theory is based on the logic that excessive fear tends to drive down share prices, and too much greed tends to have the opposite effect.

How is Fear & Greed Calculated?

The Fear & Greed Index is a compilation of seven different indicators that measure some aspect of stock market behavior. They are market momentum, stock price strength, stock price breadth, put and call options, junk bond demand, market volatility, and safe haven demand. The index tracks how much these individual indicators deviate from their averages compared to how much they normally diverge. The index gives each indicator equal weighting in calculating a score from 0 to 100, with 100 representing maximum greediness and 0 signaling maximum fear.

How often is the Fear & Greed Index calculated?

Every component and the Index are calculated as soon as new data becomes available.

How to use Fear & Greed Index?

The Fear & Greed Index is used to gauge the mood of the market. Many investors are emotional and reactionary, and fear and greed sentiment indicators can alert investors to their own emotions and biases that can influence their decisions. When combined with fundamentals and other analytical tools, the Index can be a helpful way to assess market sentiment.
sentiment

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?


just trying to make a living
또한 다음에서도:

면책사항