OPEN-SOURCE SCRIPT
Market Breadth Composite

## Market Breadth Composite
Market Breadth Composite is a market breadth indicator designed to measure the internal health of the broader U.S. equity market.
The indicator tracks the percentage of stocks trading above their 200-day moving average across three breadth universes:
1. S&P 500 breadth
2. NYSE breadth
3. Nasdaq breadth
It then calculates a composite average from the enabled and available feeds. This helps users view broad market participation through one cleaner composite reading instead of relying on a single market index.
This script is not a standalone buy or sell signal. It is intended to be used as a market regime and risk-environment filter.
---
## How It Works
The script requests breadth data from the selected symbols and calculates the current value for each enabled universe.
The default feeds are:
* S5TH: S&P 500 percentage of stocks above the 200-day moving average
* MMTH: NYSE percentage of stocks above the 200-day moving average
* NDTH: Nasdaq percentage of stocks above the 200-day moving average
The composite value is calculated by averaging the active and available feeds.
If one of the selected feeds is unavailable, the script continues to calculate the composite using the remaining available feeds.
An optional EMA smoothing setting is included to reduce short-term noise in the composite line.
---
## Market Regime Logic
The indicator uses configurable regime levels:
* Risk-Off Level: default 40
* Healthy Level: default 60
* Strong Level: default 80
The current market state is classified as follows:
* Risk-Off: composite is below the Risk-Off Level
* Neutral: composite is between the Risk-Off Level and the Healthy Level
* Healthy: composite is above the Healthy Level but below the Strong Level
* Strong: composite is above the Strong Level
These levels are not trading guarantees. They are reference zones designed to help users evaluate broad market participation.
---
## Visual Output
The script displays:
* A composite breadth line
* Optional component lines for S&P 500, NYSE, and Nasdaq breadth
* Configurable regime reference levels
* Optional risk-regime background shading
* A status table showing the component values, composite value, market state, and active feed count
The table is designed to provide a quick summary of market conditions while keeping the chart clean and easy to read.
---
## How To Use
This indicator is best used as a market environment filter.
Users may use it to understand whether broad market participation is weak, mixed, improving, or strong.
General interpretation:
* Below 40: breadth is weak and market risk may be elevated
* Between 40 and 60: breadth is mixed or neutral
* Above 60: breadth participation is healthier
* Above 80: breadth participation is broadly strong
The indicator should be interpreted together with price action, trend structure, support and resistance, volume, and risk management.
It is not designed to replace a complete trading plan.
---
## Alerts
The script includes the following alert conditions:
1. Composite Breadth -> Risk-Off
Triggered when the composite crosses below the Risk-Off Level.
2. Composite Breadth -> Recovery Above Risk-Off
Triggered when the composite crosses back above the Risk-Off Level.
3. Composite Breadth -> Healthy
Triggered when the composite crosses above the Healthy Level.
4. Composite Breadth -> Strong
Triggered when the composite crosses above the Strong Level.
5. Composite Breadth -> Back To Neutral
Triggered when the composite crosses below the Healthy Level after being in a healthier breadth zone.
6. Composite Breadth -> Lost Strong Status
Triggered when the composite crosses below the Strong Level after being in the Strong zone.
These alerts are intended to help users monitor changes in broad market breadth conditions without treating them as direct trade signals.
---
## Important Notes
This script does not predict future market direction.
It does not guarantee entries, exits, tops, bottoms, crashes, recessions, or recoveries.
It does not provide financial advice.
It is an analytical tool for studying market breadth and market regime.
Users are responsible for their own analysis, decisions, and risk management.
Market Breadth Composite is a market breadth indicator designed to measure the internal health of the broader U.S. equity market.
The indicator tracks the percentage of stocks trading above their 200-day moving average across three breadth universes:
1. S&P 500 breadth
2. NYSE breadth
3. Nasdaq breadth
It then calculates a composite average from the enabled and available feeds. This helps users view broad market participation through one cleaner composite reading instead of relying on a single market index.
This script is not a standalone buy or sell signal. It is intended to be used as a market regime and risk-environment filter.
---
## How It Works
The script requests breadth data from the selected symbols and calculates the current value for each enabled universe.
The default feeds are:
* S5TH: S&P 500 percentage of stocks above the 200-day moving average
* MMTH: NYSE percentage of stocks above the 200-day moving average
* NDTH: Nasdaq percentage of stocks above the 200-day moving average
The composite value is calculated by averaging the active and available feeds.
If one of the selected feeds is unavailable, the script continues to calculate the composite using the remaining available feeds.
An optional EMA smoothing setting is included to reduce short-term noise in the composite line.
---
## Market Regime Logic
The indicator uses configurable regime levels:
* Risk-Off Level: default 40
* Healthy Level: default 60
* Strong Level: default 80
The current market state is classified as follows:
* Risk-Off: composite is below the Risk-Off Level
* Neutral: composite is between the Risk-Off Level and the Healthy Level
* Healthy: composite is above the Healthy Level but below the Strong Level
* Strong: composite is above the Strong Level
These levels are not trading guarantees. They are reference zones designed to help users evaluate broad market participation.
---
## Visual Output
The script displays:
* A composite breadth line
* Optional component lines for S&P 500, NYSE, and Nasdaq breadth
* Configurable regime reference levels
* Optional risk-regime background shading
* A status table showing the component values, composite value, market state, and active feed count
The table is designed to provide a quick summary of market conditions while keeping the chart clean and easy to read.
---
## How To Use
This indicator is best used as a market environment filter.
Users may use it to understand whether broad market participation is weak, mixed, improving, or strong.
General interpretation:
* Below 40: breadth is weak and market risk may be elevated
* Between 40 and 60: breadth is mixed or neutral
* Above 60: breadth participation is healthier
* Above 80: breadth participation is broadly strong
The indicator should be interpreted together with price action, trend structure, support and resistance, volume, and risk management.
It is not designed to replace a complete trading plan.
---
## Alerts
The script includes the following alert conditions:
1. Composite Breadth -> Risk-Off
Triggered when the composite crosses below the Risk-Off Level.
2. Composite Breadth -> Recovery Above Risk-Off
Triggered when the composite crosses back above the Risk-Off Level.
3. Composite Breadth -> Healthy
Triggered when the composite crosses above the Healthy Level.
4. Composite Breadth -> Strong
Triggered when the composite crosses above the Strong Level.
5. Composite Breadth -> Back To Neutral
Triggered when the composite crosses below the Healthy Level after being in a healthier breadth zone.
6. Composite Breadth -> Lost Strong Status
Triggered when the composite crosses below the Strong Level after being in the Strong zone.
These alerts are intended to help users monitor changes in broad market breadth conditions without treating them as direct trade signals.
---
## Important Notes
This script does not predict future market direction.
It does not guarantee entries, exits, tops, bottoms, crashes, recessions, or recoveries.
It does not provide financial advice.
It is an analytical tool for studying market breadth and market regime.
Users are responsible for their own analysis, decisions, and risk management.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน