OPEN-SOURCE SCRIPT
Diupdate

Fear & Greed [theUltimator5]

138
This indicator attempts to replicate CNN's Fear & Greed Index methodology to measure market sentiment on a scale from 0-100. It combines seven key market components into a single sentiment score, where lower values indicate fear and higher values indicate greed.
Note: It is impossible to perfectly replicate the true Fear & Greed indicator due to data limitations, so this indicator attempts to best replicate the output for each of the (7) components using available data.

The uniqueness of this indicator comes from the calculation methods for the 7 components as well as the visual representation of the data, which includes a table and selectable plots for each of the 7 components which make up the overall sentiment. Existing variants of the Fear & Greed Index have substantial flaws in the calculations of several of the components which result in warped final sentiment numbers. This indicator attempts to better track all 7 components and provide a closer model to the actual Fear & Greed index.

Here are the seven components and a brief description of how each are calculated:
1. Market Momentum
Calculation: S&P 500 current price vs. 125-day moving average
Measures how far the market has moved from its long-term trend
Uses CNN-style Z-score normalization over 252 trading days
Higher values indicate strong upward momentum (greed)
Lower values suggest declining momentum (fear)

2. Stock Strength
Calculation: S&P 500 RSI scaled to 252-day range
Uses 14-period RSI of the S&P 500 index
Normalizes RSI values based on their 252-day minimum and maximum
Measures overbought/oversold conditions relative to recent history
Higher values indicate overbought conditions (greed)
Lower values suggest oversold conditions (fear)

3. Price Breadth
Calculation: Modified McClellan Oscillator
Primary: Uses NYSE advancing vs. declining issues with 7-day smoothing
Fallback: Compares sector performance (QQQ, IWM vs. SPY)
Measures how many stocks participate in market moves
Broader participation indicates healthier trends
Narrow breadth suggests selective or weak trends

4. Put/Call Ratio
Calculation: Inverted CBOE Put/Call ratios
Primary: CBOE Equity-only Put/Call ratio (more sensitive)
Fallback: CBOE Total Put/Call ratio
Uses 5-day average and applies CNN normalization
Higher put/call ratios indicate fear (inverted to lower scores)
Lower put/call ratios suggest complacency (higher scores)

5. Market Volatility
Calculation: VIX relative to its 50-day average
Compares current VIX level to its 50-day moving average
Measures deviation from normal volatility expectations
Higher VIX relative to average indicates fear (lower scores)
Lower relative VIX suggests complacency (higher scores)

6. Safe Haven Demand
Calculation: Stock returns vs. bond yield changes
Compares 20-day smoothed S&P 500 returns to Treasury yield changes
When stocks outperform bonds, indicates risk appetite (higher scores)
When bonds outperform stocks, suggests risk aversion (lower scores)
Uses Treasury 10-year yields as the safe haven benchmark

7. Junk Bond Demand
Calculation: High-yield bond spread analysis
Measures yield spread between junk bonds (JNK ETF) and Treasuries
Compares current spread to its 5-day average
Narrowing spreads indicate risk appetite (higher scores)
Widening spreads suggest risk aversion (lower scores)

The combined sentiment is plotted as a single line which changes color based on the current sentiment value.
0-25: Extreme Fear (Red) - Market panic, oversold conditions
26-45: Fear (Orange) - Cautious sentiment, bearish bias
46-55: Neutral (Yellow) - Balanced market sentiment
56-75: Greed (Light Green) - Optimistic sentiment, bullish bias
76-100: Extreme Greed (Green) - Market euphoria, potentially overbought

There are dashed lines to represent the threshold values for each of the sentiments to better visualize transitions.

The table displays each of the (7) components of the index and their respective values. The table can be toggled on/off and the position can be moved.

An optional secondary line can be toggled on to display (1) of the (7) components as a unique color and the component name and value will highlight on the table. The secondary line can be used to dig into the main driving forces behind the overall index value.

cuplikan
Catatan Rilis
Update to chart to prevent duplicate in the description.
Catatan Rilis
Minor change to (7)
SMA change from 5 to 6

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.