OPEN-SOURCE SCRIPT

Fear & Greed Oscillator - Risk Sentiment

140
The Fear & Greed Oscillator – Risk Sentiment is a macro-driven sentiment indicator inspired by the popular Fear & Greed Index, but rebuilt from the ground up using real, market-based economic data and statistical normalization.

While the traditional Fear & Greed Index uses components like volatility, volume, and social media trends to estimate sentiment, this version is powered by the Copper/Gold ratio — a historically respected gauge of macroeconomic confidence and risk appetite.

📈 Expansion vs. Contraction Theory

At the heart of this oscillator is a simple macroeconomic insight:

🟢 Copper performs well during periods of economic expansion and risk-on behavior (industrials, construction, manufacturing growth).

🔴 Gold performs well during periods of economic contraction, as a classic risk-off, capital-preserving asset.

By tracking the ratio of Copper to Gold prices over time and converting it into a Z-score, this tool shows when macro sentiment is statistically stretched toward greed or fear — based on how unusually strong one side of the ratio is relative to its historical average.

⚙️ How It Works

The script takes two user-defined tickers (default: Copper and Gold) and calculates their ratio.

It then applies Z-score normalization over a user-defined period (default: 200 bars).

A color gradient line is plotted:

🔴 Z < -2 = Extreme Fear

🟣 -2 to 0 = Mild Fear to Neutral

🔵 0 to 2 = Neutral to Greed

🟢 Z > 2 = Extreme Greed

Visual guides at ±1, ±2, ±3 standard deviations give immediate context.

Includes alert conditions when the Z-score crosses above +2 (Greed) or below -2 (Fear).

🔔 Alerts

“Z-Score has entered the Greed Zone” when Z > 2

“Z-Score has entered the Fear Zone” when Z < -2

These are designed to help catch macro sentiment extremes before or during large shifts in market behavior.

⚠️ Disclaimer

This indicator is a macro sentiment tool, not a direct trading signal. While the Copper/Gold ratio often reflects economic risk trends, correlation with risk assets (like Bitcoin or equities) is not guaranteed and may vary by cycle. Always use this indicator in conjunction with other tools and contextual analysis.

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.