OPEN-SOURCE SCRIPT

Adil Hoca - US Market Score Only Nasdaq

76
Market Score & Crash Detector Indicator

User Guide & Usage Instructions

This TradingView indicator provides a comprehensive market risk assessment, combining multiple financial metrics to detect potential market crashes, recessions, and overall trend regimes. It is especially designed to alert traders and investors about early warning signals before significant market downturns, enabling proactive decision-making.

Key Features
Multi-Metric Market Sentiment: Uses volatility indices, currency strength, yield spreads, breadth, and bond ratios to evaluate market health.
Crash Detection System: Monitors various conditions such as VIX spikes, breadth collapse, momentum cliffs, high-yield spread surges, and hidden market weaknesses.
Reccession Indicator: Incorporates the Sahm Rule, a proven recession indicator based on employment data.
Alert System: Sends real-time alerts for critical market conditions, including crashes, recession signals, and spreads alerts.
Visual Elements: Includes histograms, trend lines, threshold lines, and shape signals to visually interpret market states.
Customizable Parameters: Adjust weights, sensitivity, thresholds, and alert preferences to suit your trading style.


How it Works
1. Data Collection
The indicator fetches data from multiple sources:
Market volatility: VIX index
Currency strength: DXY index
Interest rates: SOFR, PCE inflation
Yield spreads: High Yield Credit Spread, Investment Grade Spread
Market Breadth: Ratio of QQQ to TLT (tech vs. bonds)
Bond Ratios: TMF/TMV (long-term bonds)
Employment Data: The Sahm Rule (monthly unemployment data)

2. Normalization
Data is normalized via z-score calculations over defined periods to standardize the metrics, making them comparable regardless of their original scale.

3. Composite Score Calculation
Each metric is weighted according to user-defined parameters, and a composite score is generated to represent the overall market sentiment, smoothed with an EMA for trend clarity.

4. Crash & Recession Detection
Crash System: Looks for conditions like VIX spikes, breadth collapse, momentum drops, high yield spread surges, and hidden weaknesses. If multiple conditions meet thresholds, alerts trigger.
Recession Indicator: Uses the Sahm Rule, which compares the current unemployment rate's three-month average to the lowest point over the past 12 months. When it exceeds a certain threshold, a recession signal is generated.

5. Alerts & Visualization
Sound & Shape Alerts: Signals like warning triangles, cross icons, and color changes.
Threshold Lines: Indicate levels like "Strong Bullish," "Strong Bear," and critical zones.
Dual Confirmation: Combines crash and recession signals for high-confidence alerts.


Usage & Customization
Placing the Indicator
Copy and paste the Pine Script code into TradingView's Pine Editor.
Save and add the script to your chart. Adjust inputs like weights, sensitivity mode, thresholds, and alert preferences via the input panel.


Key Inputs
Weights: Customize the importance of each metric.
Sensitivity Mode: Changes alert thresholds for early warnings.
Crash Sensitivity: Defines how many indicators need to trigger before issuing a crash alert.
Recession Thresholds: Set the unemployment level that signals recession.


Interpreting Visuals
Histogram: Shows the composite score; green means bullish, red indicates bearish.
Momentum Line: Highlights trend acceleration/deceleration.
Threshold Lines: Dotted/dashed lines showing critical zones.
Shape Shapes: Triangles or crosses appear for early signals or critical events.


Alerts
Crash Alerts: Warn of imminent market crashes.
Recession Alerts: Indicate economic downturns based on Sahm Rule.
Spread Alerts: Show high-yield credit spread surges signaling stress.
Double Confirmation: High-confidence signals when crash and recession conditions align.


Best Practices
Use on multiple timeframes for confirmation.
Combine with other technical analysis tools for better accuracy.
Adjust thresholds according to your risk appetite.
Follow alert signals for early warning but always consider overall context.


Final Notes
This indicator synthesizes a variety of leading and lagging indicators to give a holistic view of market health. It is designed to provide early warnings, especially in volatile or stressed environments, helping traders avoid severe drawdowns or position ahead of major downturns.
Feel free to modify input parameters for your preferences, or integrate additional data sources for further refinement.


This detailed explanation can be directly included as a description or documentation within your TradingView script, helping users grasp its full capabilities and optimal usage.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.