OPEN-SOURCE SCRIPT
已更新

US Macro Cycle (Z-Score Model)

167
US Macro Cycle (Z-Score Model)

This indicator tracks the US economic cycle in real time using a weighted composite of seven macro and market-based indicators, each converted into a rolling Z-score for comparability. The model identifies the current phase of the cycle — Expansion, Peak, Contraction, or Recovery — and suggests sector tilts based on historical performance in each phase.

Core Components:

Yield Curve (10y–2y): Positive & steepening = growth; inverted = slowdown risk.

Credit Spreads (HYG/LQD): Tightening = risk-on; widening = risk-off.

Sector Leadership (Cyclicals vs. Defensives): Measures market leadership regime.

Copper/Gold Ratio: Higher copper = growth signal; higher gold = defensive.

SPY vs. 200-day MA: Equity trend strength.

SPY/IEF Ratio: Stocks vs. bonds relative strength.

VIX (Inverted): Low/falling volatility = supportive; high/rising = risk-off.

Methodology:

Each series is transformed into a rolling Z-score over the selected lookback period (optionally using median/MAD for robustness and winsorization to clip outliers).

Z-scores are combined using user-defined weights and normalized.

The smoothed composite is compared against phase thresholds to classify the macro environment.

Features:

Customizable Weights: Emphasize the indicators most relevant to your strategy.

Adjustable Thresholds: Fine-tune cycle phase definitions.

Background Coloring: Visual cue for the current phase.

Summary Table: Displays composite Z, confidence %, and individual Z-scores.

Alerts: Trigger when the phase changes, with details on the composite score and recommended tilt.

Use Cases:

Align sector rotation or relative strength strategies with the macro backdrop.

Identify favorable or defensive phases for tactical allocation.

Monitor macro turning points to manage portfolio risk.

It's doesn't fill nan gaps so there is quite a bit of zeroes, non-repainting.
版本注释
...
版本注释
I added tooltips.

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。