OPEN-SOURCE SCRIPT
Updated

Retail Sentiment Indicator - Multi-Asset CFD & Fear/Greed Index

3 002
Retail Sentiment Indicator - Multi-Asset CFD & Fear/Greed Index

Overview
The Retail Sentiment Indicator provides real-time sentiment data for major financial instruments including stocks, forex, commodities, and cryptocurrencies. This indicator displays retail trader positioning and market sentiment using CFD data and fear/greed indices.

Methodology and Scale Calculation

This indicator operates on a **-50 to +50 scale** with zero representing perfect market equilibrium.

Scale Interpretation:
- **Zero (0)**: Market balance - exactly 50% of investors buying, 50% selling
- **Positive values**: Majority buying pressure
- Example: If 63% of investors are buying, the indicator shows +13 (63 - 50 = +13)
- **Negative values**: Majority selling pressure
- Example: If 92% of investors are selling, the indicator shows -42 (50 - 92 = -42)

BTC Fear & Greed Index Scaling:
The original `BTC FEAR&GREED` index is natively scaled from 0-100 by its creator. In our indicator, this data has been rescaled to also fit the -50 to +50 range for consistency with other sentiment data sources.

This unified scaling approach allows for direct comparison across all instruments and data sources within the indicator.

-Important Data Source Selection-

Bitcoin (BTC) Data Sources
When viewing Bitcoin charts, the indicator offers **two different data sources**:

1. **Default Auto-Mode**: `BTCUSD Retail CFD` - Retail CFD traders sentiment data (automatically loaded).
2. **Manual Selection**: `BTC FEAR&GREED` - Fear & Greed Index from website: alternative dot me

**To access BTC Fear & Greed Index**: Input settings -> disable checkbox "Auto-load Sentiment Data" -> manually select "BTC FEAR&GREED" from the dropdown menu.

US Stock Market Data Sources
For US stocks and indices (S&P 500, NASDAQ, Dow Jones), there are **two data source options**:

1. **Default Auto-Mode**: Individual retail CFD sentiment data for each instrument
2. **Manual Selection**: `SNN FEAR&GREED` - SNN's Fear & Greed Index covering the overall US market sentiment. SNN was used as the name to avoid any potential trademark infringement.

**To access SNN Fear & Greed Index**: When viewing US market charts, disable in input settings checkbox "Auto-load Sentiment Data" and manually select "SNN FEAR&GREED" from the dropdown menu.

This distinction allows traders to choose between **instrument-specific retail sentiment** (auto-mode) or **broader market sentiment indices** (manual selection).

Features
- **Auto-Detection**: Automatically loads sentiment data based on the current chart symbol
- **Manual Selection**: Choose from 40+ supported instruments when auto-detection is unavailable
- **Multiple Data Sources**: Combines retail CFD sentiment with Fear & Greed indices
- **Visual Zones**: Clear greed/fear zones with color-coded backgrounds
- **Real-time Updates**: Live sentiment data from merged data sources

Supported Instruments

Major Indices
- S&P 500, NASDAQ, Dow Jones 30, DAX

Forex Pairs
- Major pairs: EURUSD, GBPUSD, USDJPY, USDCHF, USDCAD
- Cross pairs: EURJPY, GBPJPY, AUDUSD, NZDUSD, and 20+ others

Commodities
- Precious metals: Gold (XAUUSD), Silver (XAGUSD)
- Energy: WTI Oil
- Agricultural: Wheat, Coffee
- Industrial: Copper

Cryptocurrencies
- Bitcoin (BTC) sentiment data
- BTC & SNN Fear & Greed indices

How to Use
1. **Auto Mode** (Default): Enable "Auto-load Sentiment Data" to automatically display sentiment for the current chart symbol
2. **Manual Mode**: Disable auto-load and select from the dropdown menu for specific instruments
3. **Interpretation**:
- Values above 0 (green) indicate retail greed/bullish sentiment
- Values below 0 (red) indicate retail fear/bearish sentiment
- Fear & Greed indices use 0-100 scale (50 is neutral)

Data Sources
This indicator uses curated sentiment data from retail CFD providers and established fear/greed indices. Data is updated regularly and sourced from reputable financial data providers.

Trading Strategy & Market Philosophy

Contrarian Trading Approach
The primary purpose of this indicator is based on the fundamental market principle that **the majority of retail investors are often wrong**, and markets typically move opposite to the positions held by the majority of market participants.

Key Strategy Guidelines:
- **Contrarian Signal**: When the majority of users are positioned on one side of the market, there is statistically greater market advantage in taking positions in the opposite direction
- **Trend Exhaustion Signal**: An interesting observed phenomenon occurs when, during a long-lasting trend where the majority of investors have consistently been on the wrong side, the Sentiment indicator suddenly shows that the majority has flipped and opened positions in the direction of that long-running trend. This is often a signal of fuel exhaustion for further movement in that direction

Interpretation Examples
- High greed readings (majority bullish) → Consider bearish opportunities
- High fear readings (majority bearish) → Consider bullish opportunities
- Sudden sentiment flip during established trends → Potential trend reversal signal

Technical Notes
- Built with PineScript v6
- Dynamic symbol detection with fallback options
- Optimized for performance with minimal resource usage
- Color-coded visualization with customizable zones

Data Sources & Expansion

Acknowledgments
We extend our gratitude to **TradingView** for enabling the use of custom data feeds based on GitHub repositories, making this comprehensive sentiment analysis possible.

Data Expansion Opportunities
As the operator of this indicator, I am **open to suggestions for new data sources** that could be integrated and published. If you have ideas for additional instruments or sentiment data:

How to Submit Suggestions:
1. Send a **private message** with your proposal
2. Include: **instrument/data type**, **source**, and **brief description**
3. If technically feasible, we will work to import and publish the data

Data Infrastructure Status

Current Data Upload Process:
Please note that sentiment data uploads may occasionally experience minor interruptions. However, this should not pose significant issues as sentiment data typically changes gradually rather than rapidly.

Infrastructure Development:
We are actively working on establishing permanent cloud-based infrastructure to ensure continuous, automated data collection and upload processes. This will provide more reliable and consistent data availability in the future.

Disclaimer
This indicator is for educational and informational purposes only. Sentiment data should be used as part of a comprehensive trading strategy and not as the sole basis for trading decisions. Past performance does not guarantee future results. The contrarian approach described is a market theory and may not always produce profitable results.
Release Notes
UPDATE NOTES - Retail Sentiment Indicator v2.0
============================================

Important Update: Indicator Split into Two Versions
---------------------------------------------------

Due to TradingView's limitation of 40 data requests per indicator, the original Retail Sentiment Indicator has been split into TWO separate indicators:

1. Retail Sentiment Indicator - Index/Crypto/Commodity** (this indicator)
2. Retail Forex Sentiment Fear/Greed CurrencyPairs (separate indicator for specialized in forex pairs)

Please look at both indicators to access all sentiment data.


NEW DATA SOURCES - Major Additions
==================================

SNN Fear & Greed Index Components. 'SNN' was used as the name to avoid any potential trademark infringement.
---------------------------------
For the first time, you can now access INDIVIDUAL COMPONENTS of the SNN Fear & Greed Index:

- **JUNK_BOND_DEMAND by SNN** - Measures demand for high-yield (junk) bonds vs investment-grade bonds
- **CALL/PUT_OPTIONS by SNN** - Options market sentiment (scaled and inverted for consistent interpretation)
- **SAFE_HAVEN_DEMAND by SNN** - Measures flight to safety (bonds vs stocks performance)
- **STOCK_PRICE_BREADTH by SNN** - Market breadth indicator (advancing vs declining stocks)
- **STOCK_PRICE_STRENGTH by SNN** - Measures stocks making 52-week highs vs lows

These components allow for deeper analysis of what's driving overall market sentiment.


SNN FEAR&GREED Custom - Enhanced Calculation
--------------------------------------------
The original SNN Fear & Greed Index includes some less valuable components like index deviation from moving average. The **'SNN FEAR&GREED Custom'** provides an alternative calculation that:

- REMOVES less meaningful components (moving average deviation)
- INCREASES weights for more significant sentiment elements
- Focuses on: Put/Call options (6x weight, inverted), Safe Haven Demand (1.5x weight), Stock Price Breadth (2x weight), and Stock Price Strength

Formula: ((PUT_CALL_OPTIONS*6)/(-1) - 15) + (SAFE_HAVEN_DEMAND*1.5) + (STOCK_PRICE_BREADTH*2) + STOCK_PRICE_STRENGTH) / 4


US Individual Investor Sentiment Data (AII)
--------------------------------------------
New access to USA Individual Investors sentiment survey data:

- **USA_EquityIndividualInvBullish%** - Percentage of individual investors who are bullish
- **USA_EquityIndividualInvBearish** - Percentage of individual investors who are bearish
- **USA_EquityIndividualInvSentiment** - Composite sentiment index calculated from Bull, Bear, AND Neutral percentages
- **USA_EquityIndividualInvBull-Bear** - Simple spread: Bullish% minus Bearish% (classic contrarian indicator)

The Bull-Bear spread is a well-known contrarian indicator - extreme readings or divergences often precede market reversals.


NEW INSTRUMENTS ADDED
=====================

Equity Indices (International)
------------------------------
- GB100equity Index CFD
- JAPAN225equity Index CFD
- EURSTOCKS50 Index CFD
- POLAND WIG20equity Index CFD
- USA2000equity Index CFD (2000 US Small Caps)
- FRANCE40equity Index CFD

Precious Metals
---------------
- Platin CFD (Platinum)
- Pallad CFD (Palladium)

Agricultural Commodities
------------------------
- NATGAS CFD (Natural Gas)
- CORN CFD
- SOYBEANS CFD
- SUGAR CFD
- COCOA CFD

Cryptocurrencies
----------------
- LTCUSD CFD (Litecoin)
- XRPUSD CFD (Ripple)
- DOGEUSD CFD (Dogecoin)
- SOLUSD CFD (Solana)
- LINKUSD CFD (Chainlink)

Other
-----
- Call/Put - Call/Put Ratio from official CBOE data (USI:PCC), scaled to -50/+50 range


HOW TO ACCESS NEW DATA
======================

1. Disable "Auto-load Sentiment Data" checkbox in indicator settings
2. Select desired data source from the dropdown menu:
- For SNN components: Select any "by SNN" option
- For US individual investor data: Select any "USA_Equity..." option
- For custom SNN calculation: Select "SNN FEAR&GREED Custom"


INTERPRETATION NOTES
====================

SNN Fear & Greed Components
---------------------------
Each component provides insight into different market aspects:
- High JUNK_BOND_DEMAND = Risk-on appetite (greed)
- High SAFE_HAVEN_DEMAND = Flight to safety (fear)
- High STOCK_PRICE_BREADTH = Broad market participation (healthy trend)
- High STOCK_PRICE_STRENGTH = More highs than lows (momentum)
- Low CALL/PUT ratio = More puts being bought (fear/hedging)

USA Individual Investor Sentiment
--------------------------------
USA Individual Investor Survey has been a reliable contrarian indicator since 1987:
- Extreme bullishness often precedes corrections
- Extreme bearishness often precedes rallies
- The Bull-Bear spread at extremes (+/- 20 or more) is particularly significant


REMINDER: CONTRARIAN TRADING APPROACH
=====================================

Sentiment data should be used as part of a comprehensive trading strategy, not as a sole decision-making tool.


DATA UPDATE FREQUENCY
=====================

All data sources are updated regularly. Some data (like USA Individual Investor) is released weekly, while CFD sentiment data updates more frequently. Please refer to the main indicator description for infrastructure status updates.
Release Notes
Grammar letter correction in string desc.

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.