ที่อัปเดต:

Market State Distribution Engine v2 [Breadth Model]

3 824
Market State Distribution [Trade_Logic1019]

Market State Distribution is a breadth-based market internals indicator designed to visualize the balance between demand and supply using underlying participation, structural strength, and leadership behavior.
Rather than relying on price alone, the model aggregates multiple internal components into a normalized framework to help evaluate whether conditions are improving, weakening, or transitioning.
This script is intended for educational and informational purposes only. It does not provide financial advice or standalone trading signals.
________________________________________
Overview
Market State Distribution is built to help evaluate underlying market conditions using internal breadth data.
Instead of focusing on a single metric, the model combines multiple internal inputs into a unified structure. This allows users to assess whether internal conditions appear:
• Supportive
• Weakening
• Mixed or transitional
The goal is to provide a simplified view of broader market conditions.
________________________________________
Quick Read Guide
• Demand > Supply → Internal conditions are more supportive
• Supply > Demand → Internal conditions are weaker
• Crossovers → Potential internal shifts in control
• Expansion state → Early-stage improvement environment
• Trend state → Sustained participation and stronger conditions
• Demand ≈ Supply → Mixed / lower conviction environment
This indicator is designed as a context tool, not a signal generator.
________________________________________
Data Inputs
The model uses breadth-style market internals as its primary inputs. By default, these include:
• Percent of symbols above intermediate-term moving average (INDEX:S5FI)
• Percent of symbols above longer-term moving average (INDEX:S5TH)
• New highs minus new lows (INDEX:NYHL)
These inputs are used to approximate:
• Participation (breadth of strength)
• Structural strength (trend stability)
• Leadership behavior (expansion vs deterioration)
Some data inputs may require specific Trading View subscriptions.
Users may substitute equivalent symbols depending on availability.
________________________________________
Core Model Components
Participation Strength
Measures how broadly strength is distributed across the market using intermediate-term breadth data.
Higher values suggest broader participation; lower values suggest narrowing conditions.
Structural Strength
Represents longer-term trend alignment using broader participation above long-term averages.
Helps assess whether underlying structure is supportive or deteriorating.
Leadership Behavior
Uses new highs vs new lows data to evaluate whether leadership is expanding or weakening.
Provides confirmation beyond participation metrics alone.
________________________________________
State Modeling
The indicator transforms the underlying inputs into normalized components and combines them into a synthetic state model.
The model estimates the relative distribution of:
• Trend
• Expansion
• Decay
• Transition
These are descriptive categories designed to reflect current internal conditions, not predict future price movement.
________________________________________
Demand vs Supply Framework
The core output of the indicator is the relationship between Demand and Supply:
• Demand = Trend + Expansion components
• Supply = Decay component
Interpretation (contextual, not prescriptive):
• Demand > Supply → Internal conditions may be more supportive
• Supply > Demand → Internal conditions may be weaker
• Demand ≈ Supply → Conditions may be mixed or transitional (lower conviction environment)
This framework is intended to help interpret internal market tone.
________________________________________
State Classification
The indicator classifies the current environment into one of four states:
• Trend
• Expansion
• Decay
• Transition
These labels summarize which internal condition appears most dominant.
________________________________________
Shift Detection
The model evaluates changes in the Demand/Supply relationship to identify internal shifts:
• Demand crossing above Supply → Improving conditions
• Supply crossing above Demand → Deteriorating conditions
• No crossover → No significant change
This is designed to highlight internal shifts, not generate trade signals.
________________________________________
Visualization
Primary Lines
• Demand
• Supply
These are plotted in a separate pane to visualize internal strength vs deterioration over time.
Summary Table (Optional)
Provides a structured overview of:
• Control (Demand vs Supply dominance)
• Breadth condition
• Market condition
• State classification
• Shift
• Read (contextual interpretation)
• Bias (contextual framing)
Optional end-of-line labels can be enabled for clarity.
________________________________________
How to Use
This indicator is designed as a market context tool.
A typical workflow may include:
1. Applying the indicator to a broad market index
2. Observing whether Demand or Supply is dominant
3. Reviewing the state table for context
4. Combining insights with price structure, volatility, and risk management
The objective is to support contextual awareness—not replace independent analysis.
________________________________________
Configurable Inputs
Data Sources
• Custom breadth symbols for participation, structure, and leadership inputs
Logic Settings
• Smoothing length
• Control gap threshold
• Demand strength/weakness levels
• Decay dominance level
Display Options
• Show/hide summary table
• Show/hide line labels
• Show/hide reference levels
• Table size customization
________________________________________
Important Notes
• This script is provided for educational and informational purposes only
• It does not provide financial advice or trade recommendations
• It does not execute trades or manage positions
• Outputs are descriptive, not predictive
• Historical behavior does not guarantee future results
• Data availability may vary depending on your Trading View plan
All trading decisions should be made using independent judgment and appropriate risk management.

Release Note
Market State Distribution Engine v2.1 [Breadth Model]

OVERVIEW
The Market State Distribution Engine measures the balance of breadth in the US stock market and presents it as two mirrored lines: Demand and Supply. It is designed to show whether participation underneath the index is supporting or contradicting price, which is useful when the index and the average stock are moving in different directions.

Note: "Demand" and "Supply" here are breadth readings built from participation, trend structure and new highs/lows. They are not order flow or volume measures.

HOW IT WORKS
The model combines three public breadth series into one composite, scaled from 0 to 100:

1. Participation (weight 0.45): percent of S&P 500 stocks above their 50-day moving average (INDEX:S5FI).
2. Structure (weight 0.40): percent of S&P 500 stocks above their 200-day moving average (INDEX:S5TH).
3. Leadership (weight 0.15): NYSE new highs minus new lows (INDEX:NYHL). Note this series covers the NYSE, not only the S&P 500.

Each series is smoothed with an 8-period EMA, then normalized to a 0-1 scale using a range centered on neutral, so balanced breadth maps to 50. The weighted average of the three becomes the Demand line. Supply is its exact mirror (Supply = 100 - Demand), so the 50 line is a true equilibrium.

HOW TO READ IT
- Demand above 50: breadth is supporting the market. Below 50: breadth is weakening.
- The 60 and 40 levels (optional reference lines) mark strong and weak breadth.
- Control: "Demand Dominant" when Demand leads Supply by more than the Control Gap (default 5 points, i.e. Demand above 52.5); "Supply Dominant" when the reverse is true; otherwise "Balanced."
- Shift: flags the bar where Demand crosses the 50 equilibrium, up ("Improving") or down ("Deteriorating").
- Demand Curl Up marker: a small triangle when Demand turns up from a decline while still below 50. This can mark early stabilization; it is not a buy signal on its own.

MARKET STATES
- TREND: Demand at or above 60 and participation momentum flat or rising. Breadth supports follow-through.
- EXPANSION: participation momentum rising while Demand is below the strong level. Breadth is improving but not yet mature.
- TRANSITION: no clear control, or strength fading. Conditions are mixed.
- DECAY: Demand at or below 40 and participation momentum flat or falling. Weak breadth dominates.

Participation momentum is the change in the percent of stocks above their 50-day MA over the lookback period (default 5 bars).

THE TABLE
The table summarizes Control, Breadth, Condition, State, Shift, the Demand/Supply values, a plain-language Read and a Bias. By default it reads the last confirmed bar, so it does not change during the session. The plotted lines do update on the live bar.

INPUTS
- Data sources: the three breadth symbols can be changed if your data provider uses different tickers.
- Normalization ranges: defaults are 25-75 (% above 50 MA), 30-70 (% above 200 MA) and -100 to +100 (NH-NL). NYSE new highs minus new lows often moves beyond plus or minus 100 on stressed days, so the leadership component reaches its limit early. Widen that range if you prefer.
- Composite weights, smoothing, momentum lookback, control gap, strong/weak levels and curl settings are all adjustable.
- Display: table on/off and size, end-of-line labels, curl marker, and optional 40/60 reference lines.

LIMITATIONS
Breadth describes participation, not direction or timing. Weak breadth can persist while an index rises, especially when gains are concentrated in a few large stocks. The model is best used as context alongside price, not as a standalone trading system. Results depend on the availability and accuracy of the underlying breadth data.

WHAT CHANGED IN v2.1
This update changes how readings are calculated, so values differ from v2, including on historical bars.
- Demand and Supply are now exact mirrors of one composite. In v2, Demand combined two scores while Supply used one, so a neutral market could read as "Demand Dominant."
- Normalization ranges are centered so neutral inputs map to 50.
- Participation momentum now drives the EXPANSION state instead of adding to the Demand line.
- The table reads the last confirmed bar by default.
- Added the Demand Curl Up marker.
- Fixed: the Bias field was blank in the DECAY state.
- Removed duplicate plots.

Demand readings are generally lower than in v2, and "Demand Dominant" now requires Demand above 52.5. Compare against previous readings before relying on old thresholds.

DISCLAIMER
This script is for educational and informational purposes only. It does not provide financial advice, trading signals or guarantees of performance. Open source under the Mozilla Public License 2.0.

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน