OPEN-SOURCE SCRIPT
Price Contraction / Expansion

1. Introduction
The Price Contraction / Expansion indicator highlights areas of market compression and volatility release by analyzing candle body size and volume behavior. It provides a fast, color-coded visualization to identify potential breakout zones, accumulation phases, or exhaustion movements.
This tool helps traders recognize when price action is tightening before a volatility expansion — a common precursor to strong directional moves.
2. Key Features
Dynamic body analysis: Compares each candle’s body size with a moving average to detect contraction (small bodies) and expansion (large bodies).
Volume confirmation: Measures whether volume is unusually high or low compared to its recent average, helping filter false breaks.
Color-coded system for clarity:
Yellow: Contraction with high volume (potential accumulation or strong activity).
Blue: Contraction with normal volume or expansion with low volume (neutral/reduced participation).
Green: Expansion in bullish candle (buyer dominance).
Red: Expansion in bearish candle (seller dominance).
Customizable parameters: Adjust body and volume averaging periods and thresholds to fit different market conditions or timeframes.
3. How to Use
Identify contraction zones: Look for blue or yellow bars to locate areas of price compression — these often precede breakouts or large movements.
Wait for expansion confirmation: A shift to green or red bars with increasing volume indicates that volatility is expanding and momentum is building.
Combine with context: Use this indicator alongside trend tools, liquidity zones, or moving averages to confirm directional bias and filter noise.
Adapt thresholds: In highly volatile markets, increase the “Threshold multiplier” to reduce false contraction signals.
This indicator is most effective for traders who focus on volatility behavior, market structure, and timing potential breakout opportunities.
The Price Contraction / Expansion indicator highlights areas of market compression and volatility release by analyzing candle body size and volume behavior. It provides a fast, color-coded visualization to identify potential breakout zones, accumulation phases, or exhaustion movements.
This tool helps traders recognize when price action is tightening before a volatility expansion — a common precursor to strong directional moves.
2. Key Features
Dynamic body analysis: Compares each candle’s body size with a moving average to detect contraction (small bodies) and expansion (large bodies).
Volume confirmation: Measures whether volume is unusually high or low compared to its recent average, helping filter false breaks.
Color-coded system for clarity:
Yellow: Contraction with high volume (potential accumulation or strong activity).
Blue: Contraction with normal volume or expansion with low volume (neutral/reduced participation).
Green: Expansion in bullish candle (buyer dominance).
Red: Expansion in bearish candle (seller dominance).
Customizable parameters: Adjust body and volume averaging periods and thresholds to fit different market conditions or timeframes.
3. How to Use
Identify contraction zones: Look for blue or yellow bars to locate areas of price compression — these often precede breakouts or large movements.
Wait for expansion confirmation: A shift to green or red bars with increasing volume indicates that volatility is expanding and momentum is building.
Combine with context: Use this indicator alongside trend tools, liquidity zones, or moving averages to confirm directional bias and filter noise.
Adapt thresholds: In highly volatile markets, increase the “Threshold multiplier” to reduce false contraction signals.
This indicator is most effective for traders who focus on volatility behavior, market structure, and timing potential breakout opportunities.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.