OPEN-SOURCE SCRIPT

Volatility Expansion Indicator - D_Quant

98
Volatility Expansion Indicator - D_Quant |V|C|E|

1. Concept & Overview
The Volatility Expansion Indicator (VCE) is a composite quantitative tool designed to identify robust trend states by aggregating signals from three distinct market dimensions: Relative Position (Volatility), Cyclical Momentum, and Price Velocity.

Unlike single-source indicators which often generate false positives during choppy markets, the VCE utilizes a "Consensus Engine." It normalizes signals from Bollinger %B, CCI, and ROC into a unified trend score (-1 to +1). This score drives the visual coloring of the price action and background, allowing traders to instantly gauge whether the market is in a state of volatility expansion (trending) or contraction (ranging).

2. Methodology & Calculation
The core logic relies on a weighted aggregation of three technical components. Users can toggle these components on or off in the settings to isolate specific market mechanics.

A. Component 1: Bollinger %B (Relative Positioning)

Logic: Measures where the price is located relative to the Bollinger Bands.

Bullish Condition: If %B > 0.5 (Price is operating in the upper hemisphere of the bands).

Bearish Condition: If %B < 0.0 (Price has broken below the lower band).

Purpose: Filters out weak trends by ensuring price is statistically significant relative to its recent volatility.

B. Component 2: CCI (Commodity Channel Index)

Logic: Measures current price levels relative to an average price level over a specific period.

Thresholds: A standard +100 / -100 threshold is used. Values above 100 add to the bullish score; values below -100 add to the bearish score.

Purpose: Identifies cyclical momentum extremes.
f_cci(_len) =>
cci_val = ta.cci(close, _len)
val = 0
if cci_val > 100
val := 1
if cci_val < -100
val := -1
val


C. Component 3: ROC (Rate of Change)

Logic: Calculates the percentage change between the current price and the price n periods ago.

Thresholds: Simple zero-line crossover. Positive ROC implies bullish velocity; negative implies bearish.

Purpose: Provides a raw directional bias based on pure price speed.

D. The Aggregation Engine: The script sums the active signals and divides by the number of active components.

Bullish Trend: Composite Score > 0 (Visualized as Deep Navy).

Bearish/Neutral: Composite Score ≤ 0 (Visualized as White).

E. Multi-Timeframe (MTF) Capability: The indicator includes a request.security module. This allows you to calculate the consensus trend on a higher timeframe (e.g., Daily) while viewing price action on a lower timeframe (e.g., 15-minute), ensuring you are trading in alignment with the macro trend.
// NEW: Timeframe Selection
tf_input = input.timeframe("", "VCE Timeframe", group=grp_sets, tooltip="Empty = Current Chart. Set to 'D' for fixed Daily trend.")
[v1, v2, v3] = request.security(syminfo.tickerid, tf_input, [f_pct_b(bb_len, bb_mult), f_cci(cci_len), f_roc(roc_len)], lookahead=barmerge.lookahead_on)


3. Visualizations
The indicator overlays the following elements on the chart:

Trend SMMA: A central Smoothed Moving Average (SMMA 20) representing the mean.

Volatility Bands: Upper and Lower bands calculated at 2 Standard Deviations from the SMMA.

Bar Coloring:

Navy Blue: Indicates a confirmed Volatility Expansion (Bullish Confluence).

White: Indicates Neutrality, Retracement, or Bearish conditions.


Dynamic Fills: The space between the bands fills with color to highlight the strength of the current regime.

4. How to Use
Trend Following: Look for the bar color to switch to Navy. This indicates that momentum, volatility, and velocity have aligned bullishly. This is often an entry trigger for long positions.

Exits: When the bars switch from Navy back to White/Gray, the volatility expansion has ceased or momentum is diverging. This serves as a warning to tighten stops or take profits.

MTF Filter: Set the "VCE Timeframe" input to "D" (Daily). Trade on the H1 chart. Only take long positions when the Daily VCE paints the background/bands in the Bullish color.

5. Settings
Bollinger %B: Adjust Length and Multiplier (Default: 20, 2.0).

CCI: Adjust Length (Default: 23).

ROC: Adjust Length (Default: 50).

Signal Components: Toggle specific logic blocks on/off to customize the sensitivity of the composite score.

VCE Timeframe: Select the resolution for the calculation (Leave empty for current chart).

Disclaimer: This tool is for informational purposes only. Past performance of volatility expansion does not guarantee future results. Always manage risk appropriately.

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.