Market State Distribution Engine v2 [Breadth Model]Market State Distribution
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.
Pine Script® indicator






















