PROTECTED SOURCE SCRIPT
已更新

Market Breadth & Forward Returns

761
This indicator shows how future index performance has historically behaved after different levels of market breadth. The heatmap reveals which breadth zones have tended to precede better or worse forward returns. This is strictly a statistical conditional-expectation map, not a set of signals.

Scope
This is not meant for any arbitrary asset.
It is meant for broad indices only (S&P 500, Nasdaq 100, Dow, Russell, major sector families).
The breadth data is derived from index-level market universes.
Do not apply this on single stocks, crypto or FX. The method only makes sense with large diversified universes.

Core method
Daily breadth is normalized 0 to 100.
For each bar, six forward horizons are evaluated on the index: performance after X days.
Each observation is placed into a breadth bin.
Each bin/horizon pair has mean, variance and count computed.
Each bin/horizon mean is t-tested against zero.
Benjamini-Hochberg False Discovery Rate weighting allocates weight only to horizons where evidence exists.
Weighted horizon means are aggregated and annualized (252 trading days).
The map displays annualized conditional forward returns per breadth bin.

Why this is robust
Non-repainting. Breadth is in the past, returns are strictly future, lookahead_off.
Multiple horizons avoid single-window biases.
Variance, t-tests and FDR correction drastically reduce false positives.
Bins with poor sample size are visually suppressed to avoid over-interpretation.

How to use
Daily timeframe only.
Select the correct index family (S&P 500, Nasdaq 100, Russell…).
Bin size 5 to 10 points is a realistic range.
Min occurrences per bin ≥ 5 recommended.
FDR alpha 0.05 to 0.10 is a good working envelope.
Interpret as conditional expectations, not a forecast guarantee.

Notes
Do not use on random assets.
Do not extrapolate outside the chosen index family.
Always keep symbol and timeframe visible when publishing.

Indicator by Julien Eche
版本注释
Minor update
版本注释
Minor update: small bugs fixed
版本注释
Reduced lookback for lower load, shorter correlation window for more responsive penalty, and adjusted visual offsets to avoid label overlap.
版本注释
Minor update: small bugs fixed
版本注释
Minor Update: Added explanatory tooltips to the main inputs to clarify how to interpret the breadth stats and use the options.
版本注释
Major Update: Macro-Economic Regimes Integration

I have expanded the tool's capabilities beyond internal Market Breadth. You can now condition market returns based on two critical external macro drivers:

  1. Yield Curve Slope (10Y-2Y): The bond market's primary leading indicator for the economic cycle. This mode allows you to quantify market performance during distinct curve phases (e.g., deep inversion vs. normalization), offering insight into how equities react to recession signals and changing growth expectations.
  2. Credit Spreads (FRED OAS): The ultimate gauge of financial stress and liquidity. By tracking the spread between US High Yield bonds and safe Treasuries, this mode isolates market behavior during "Risk-On" complacency (low spreads) versus "Risk-Off" credit stress (high spreads).


These additions transform this indicator into a comprehensive Macro-Regime backtesting engine.
版本注释
Minor update: added the new Real Rate (FRED DFII10) conditioning mode with full switch-based normalization.
版本注释
Minor update: added a new Bounds mode input (Dynamic vs Static) to control how regime bins are scaled. Dynamic keeps the current percentile-based rolling min/max, while Static locks slope/spread/real-rate ranges to fixed values. This prevents bins from drifting over time and makes historical regime comparisons consistent.
版本注释
Minor update: added the selected market name to the stats table header so the current market (e.g., S&P500) is always displayed.
版本注释
Minor Update

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。