OPEN-SOURCE SCRIPT

Market Regime Candle Dominance

419
Description: This script, "Market Regime Candle Dominance," overlays a TradingView chart to visually identify market regimes—bullish trends, bearish trends, or ranging markets—using adaptive calculations and volatility detection. It dynamically colors candles and highlights the background to indicate current market conditions.

How It Works:

Inputs:

Users define colors for bullish, bearish, and ranging trends, adjust sensitivity thresholds for volatility and trends, and set an adaptive calculation length.

Adaptive Calculation:

A period adjustment factor (calcPeriod) dynamically alters based on the chart's timeframe, ensuring meaningful calculations across different timeframes.

Volatility and Trend Detection:

Using the True Range (ta.tr) and price change (close - close[calcPeriod]), the script calculates volatility and trend strength to determine market conditions.

Trend sensitivity is adjustable through thresholds (trendThreshold), enabling finer or broader regime detection.

Market Regime Identification:

Bullish Trend: Detected when trendStrength > trendThreshold.

Bearish Trend: Triggered when trendStrength < -trendThreshold.

Ranging Market: Identified when neither bullish nor bearish trends are present.

Candle Coloring:

Candles are colored according to the market regime:

Green for bullish trends.

Red for bearish trends.

Blue (semi-transparent) for ranging markets.

Background Highlights:

An optional feature (highlightRegime) adds semi-transparent background colors corresponding to the detected regime, enhancing visual clarity of the chart.

Features:

Adaptive Sensitivity: Adjusts the calculation length and thresholds for precision across different chart timeframes.

Customizable Display: Allows users to personalize colors and enable/disable background highlights.

Visual Clarity: Simplifies the identification of market regimes, providing clear direction at a glance.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.