OPEN-SOURCE SCRIPT

Lump Sum Favorability (SPX & NDX)

237
This indicator provides a visual dashboard to gauge the statistical favorability of deploying a "Lump Sum" investment into the SPX (S&P 500) or NDX (Nasdaq 100).

The primary goal is not to time the exact market bottom, but to identify zones of significant pessimism or euphoria. Historically, periods of indiscriminate selling have represented high-probability entry points for long-term investors.

The dashboard consists of two parts:
1. The Favorability Gauge: A 12-segment gauge that moves from Red (Unfavorable) to Teal (Favorable).
2. The Summary Text: An optional text box (enabled in settings) that provides a plain-English summary of the current market breadth.

---

The Method: Market Breadth

This indicator is not based on the price of the index itself. Price-based indicators (like an RSI on the SPX) can be misleading. In a market-cap-weighted index, a few mega-cap stocks can hold the index price up while the vast majority of "average" stocks are already in a deep bear market.

This tool uses Market Breadth to measure the true, underlying health and participation of the entire market.

How It Works

1. Data Source: The indicator pulls the daily percentage of companies within the selected index (SPX or NDX) that are trading above their 200-day moving average. (Data tickers: S5TH for SPX, NDTH for NDX).
2. Smoothing: This raw data is volatile. To filter out daily noise and confirm a persistent trend, the indicator calculates a 5-day Simple Moving Average (SMA) of this percentage. This is the value used by the indicator.
3. Interpretation:
High Value (>= 50%): More than half of the stocks are above their long-term average. This signifies the market is "Overheated" or in a risk-on phase. The favorability for a new lump sum investment is considered Low.
Low Value (< 50%): Less than half of the stocks are above their long-term average. This signifies "Oversold" conditions or capitulation. These moments historically offer the best favorability for starting a new long-term investment.

---

How to Use the Indicator

1. The Favorability Gauge

The gauge is designed to be intuitive: Red means "Stop/Caution," and Teal means "Go/Opportunity."

Note: The gauge's logic is inverted from the data value to achieve this simplicity.

Red Zone (Left): UNFAVORABLE
This corresponds to a high percentage of stocks being above their 200d MA (>= 50%). The market is considered Overheated, and the favorability for a new lump sum investment is low.
Teal Zone (Right): FAVORABLE
This corresponds to a low percentage of stocks being above their 200d MA (< 50%). The market is considered Oversold, and the favorability for a new lump sum investment is high.

2. The Summary Text

When "Show Summary Text" is enabled in the settings, a box will appear at the top-center of your chart. This box provides a clear, data-driven summary, such as:

"Currently, only 22% of S&P 500 companies are above their 200-day MA. Market is Oversold."

The color of this text will automatically change to match the market state (Red for Overheated, Teal for Oversold), providing instant confirmation of the gauge's reading.

---

Settings

Market: Choose the index to analyze: SPX (S&P 500) or NDX (Nasdaq 100).
Gauge Position: Select where the gauge dashboard should appear on your chart (default is Bottom Right).
Show Summary Text: Toggle the descriptive text box on or off (default is On).

---


This indicator is a statistical and historical guide, not a financial advice or timing signal. It is designed to measure favorability based on past market behavior, not to provide certainty.

Extreme oversold conditions can persist, and markets can always go lower. This tool should be used as one component of a broader investment and risk-management framework. Past performance is not a guarantee of future results.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.