OPEN-SOURCE SCRIPT
Market Sentiment Index US Top 40 [Pt]

▮Overview
Market Sentiment Index US Top 40 [Pt} shows how the largest US stocks behave together. You pick one simple measure—High Low breakouts, Above Below moving average, or RSI overbought/oversold—and see how many of your chosen top 10/20/30/40 NYSE or NASDAQ names are bullish, neutral, or bearish.
This tool gives you a quick view of broad-market strength or weakness so you can time trades, confirm trends, and spot hidden shifts in market sentiment.
▮Key Features
► Three Simple Modes
► Universe Selection
► Timeframe Choice
► Histogram Smoothing
► Ticker Table
▮Inputs
► Mode and Lookback
► Universe Setup
► Moving Averages on Histogram
► Table Options
▮How to Read It
► Sentiment Bars
► Zero Line
► High Low Line (High Low mode only)
► MA Crosses
► Ticker Table
▮Use Cases
► Confirm Market Trends
► Spot Sector Rotation
► Filter Trade Signals
► Combine with Other Indicators
► Timeframe Analysis
Market Sentiment Index US Top 40 [Pt} shows how the largest US stocks behave together. You pick one simple measure—High Low breakouts, Above Below moving average, or RSI overbought/oversold—and see how many of your chosen top 10/20/30/40 NYSE or NASDAQ names are bullish, neutral, or bearish.
This tool gives you a quick view of broad-market strength or weakness so you can time trades, confirm trends, and spot hidden shifts in market sentiment.
▮Key Features
► Three Simple Modes
- High Low Index: counts stocks making new highs or lows over your lookback period
- Above Below MA: flags stocks trading above or below their moving average
- RSI Sentiment: marks overbought or oversold stocks and plots a small histogram
► Universe Selection
- Top 10, 20, 30, or 40 symbols from NYSE or NASDAQ
- Option to weight by market cap or treat all symbols equally
► Timeframe Choice
- Use your chart’s timeframe or any intraday, daily, weekly, or monthly resolution
► Histogram Smoothing
- Two optional moving averages on the sentiment bars
- Markers show when the faster average crosses above or below the slower one
► Ticker Table
- Optional on-chart table showing each ticker’s state in color
- Grid or single-row layout with adjustable text size and color settings
▮Inputs
► Mode and Lookback
- Pick High Low, Above Below MA, or RSI Sentiment
- Set lookback length (for example 10 bars)
- If using Above Below MA, choose the moving average type (EMA, SMA, etc.)
► Universe Setup
- Market: NYSE or NASDAQ
- Number of symbols: 10, 20, 30, or 40
- Weights: on or off
- Timeframe: blank to match chart or pick any other
► Moving Averages on Histogram
- Enable fast and slow averages
- Set their lengths and types
- Choose colors for averages and markers
► Table Options
- Show or hide the symbol table
- Select text size: tiny, small, or normal
- Choose layout: grid or one-row
- Pick colors for bullish, neutral, and bearish cells
- Show or hide exchange prefixes
▮How to Read It
► Sentiment Bars
- Green means bullish
- Red means bearish
- Near zero means neutral
► Zero Line
- Separates bullish from bearish readings
► High Low Line (High Low mode only)
- Smooth ratio of highs versus lows over your lookback
► MA Crosses
- Fast MA above slow MA hints rising breadth
- Fast MA below slow MA hints falling breadth
► Ticker Table
- Each cell colored green, gray, or red for bull, neutral, or bear
▮Use Cases
► Confirm Market Trends
- Early warning when price makes highs but breadth is weak
- Catch rallies when breadth turns strong while price is flat
► Spot Sector Rotation
- Switch between NYSE and NASDAQ to see which group leads
- Watch tech versus industrial breadth to track money flow
► Filter Trade Signals
- Enter longs only when breadth is bullish
- Consider shorts when breadth turns negative
► Combine with Other Indicators
- Use RSI Sentiment with trend tools to spot overextended moves
- Add volume indicators in High Low mode for breakout confirmation
► Timeframe Analysis
- Daily for big-picture bias
- Intraday (15-min) for precise entries and exits
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội Quy.
Purchases / Subscriptions / Support - buymeacoffee.com/ptgambler
PayPal - paypal.me/PtGambler
You can reach me privately through my Discord Channel: discord.gg/WMQfaVGyQC
PayPal - paypal.me/PtGambler
You can reach me privately through my Discord Channel: discord.gg/WMQfaVGyQC
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội Quy.
Purchases / Subscriptions / Support - buymeacoffee.com/ptgambler
PayPal - paypal.me/PtGambler
You can reach me privately through my Discord Channel: discord.gg/WMQfaVGyQC
PayPal - paypal.me/PtGambler
You can reach me privately through my Discord Channel: discord.gg/WMQfaVGyQC
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.