OPEN-SOURCE SCRIPT
Compression Expansion Map [Pineify]

Compression Expansion Map [Pineify]
Overview
Compression Expansion Map [Pineify] is a Pine Script v6 volatility lifecycle oscillator. It converts Bollinger and Keltner widths into comparable compression depths, records joint dwell, and confirms release with rising ATR.
Problem Definition
A squeeze flag only asks whether one envelope is inside another. It hides how unusual current narrowness is versus history, whether two volatility measures agree, and whether contraction has persisted. It can call any exit an expansion when width merely normalizes. Fixed thresholds transfer poorly across markets and timeframes because scales and distributions differ.
Design Rationale
Bollinger width uses standard deviation; Keltner width uses ATR. Each is basis-normalized and ranked against its own history. An agreement discount prevents one narrow envelope from creating maximum energy while the other remains broad; dwell separates a brief dip from a mature regime.
“Not compressed” is insufficient. Release must follow minimum dwell, reduce compression at minimum velocity, and show positive ATR slope. This adds lag but filters normalization. Ranks resist outliers, while sacrificing absolute magnitude.
Key Features
How It Works
Bollinger width is band distance divided by absolute basis; Keltner width is normalized identically. ta.percentrank maps each to 0–100; inversion gives high depth to historically narrow envelopes.
Average depth receives a 0.60-to-1.00 agreement factor based on depth distance. Above threshold, a bar counter starts. Progress toward Minimum Compression Bars raises energy from 75% to 100%, so Primed requires depth and residence.
Release velocity is the one-bar decline in compression; ATR slope compares current ATR with its earlier value. The first confirmed bar outside mature compression must pass both thresholds. Expansion force blends capped velocity, positive slope, and ATR percentile. It persists only while ATR rises and never beyond Maximum Expansion Hold. No future or external data is requested.
How Multiple Indicators Work Together
This is one sequence, not an unrelated blend. Bollinger observes dispersion; Keltner observes true range. Ranks create comparability, agreement prevents domination, and dwell stores persistence. Release velocity measures discharge; ATR slope tests acceleration. DNA lines expose inputs while the hero field and dashboard explain state.
Trading Ideas and Insights
A rising positive field means volatility is unusually compressed versus history. Primed is persistent compression, not direction. The expansion diamond confirms qualified release but cannot predict its direction. Repeated starts without maturity can mark unstable ranges; long dwell followed by weak release can mean normalization. These are contexts, not entry or performance claims.
Unique Aspects
The components are standard; the lifecycle is the contribution. Two normalized depths must agree, compression accumulates residence memory, and expansion requires release from maturity plus range acceleration. The charge/release layout makes order visible. Implementation is independent; no retrieved source was used, reconstructed, translated, or altered.
How to Use
Customization
Envelope Length sets the window; multipliers alter raw widths; rank lookback controls context and adaptation.
Compression Threshold controls narrowness, while Minimum Compression Bars adds maturity and lag. Release Velocity controls discharge. ATR Slope settings define acceleration: lower values react faster but admit weaker releases. Maximum Expansion Hold caps persistence. Reevaluate settings across markets and timeframes.
Assumptions and Limitations
History must be representative. Percentiles are relative, both envelopes share price data, and ATR is directionless. Expansion cannot determine breakout direction or continuation.
Live-bar values and phases may change before close; markers and alerts require barstate.isconfirmed. There is no lookahead, negative offset, external symbol, or higher-timeframe request, but the model is lagging and parameter-sensitive. Gaps, illiquidity, regime breaks, and short history reduce usefulness. Orders, fees, slippage, and profitability are outside scope.
Conclusion
Compression Expansion Map [Pineify] replaces a Boolean squeeze with an inspectable lifecycle. Depth measures charge, dwell measures maturity, and qualified release plus ATR acceleration measures expansion without claiming direction or outcomes.
Overview
Compression Expansion Map [Pineify] is a Pine Script v6 volatility lifecycle oscillator. It converts Bollinger and Keltner widths into comparable compression depths, records joint dwell, and confirms release with rising ATR.
Problem Definition
A squeeze flag only asks whether one envelope is inside another. It hides how unusual current narrowness is versus history, whether two volatility measures agree, and whether contraction has persisted. It can call any exit an expansion when width merely normalizes. Fixed thresholds transfer poorly across markets and timeframes because scales and distributions differ.
Design Rationale
Bollinger width uses standard deviation; Keltner width uses ATR. Each is basis-normalized and ranked against its own history. An agreement discount prevents one narrow envelope from creating maximum energy while the other remains broad; dwell separates a brief dip from a mature regime.
“Not compressed” is insufficient. Release must follow minimum dwell, reduce compression at minimum velocity, and show positive ATR slope. This adds lag but filters normalization. Ranks resist outliers, while sacrificing absolute magnitude.
Key Features
- Self-normalized Bollinger and Keltner bandwidth percentiles.
- Agreement-weighted compression energy with dwell maturity.
- Release velocity, ATR slope, and ATR percentile combined into expansion force.
- Centered field, DNA, halo, phases, dashboard, and confirmed alerts.
How It Works
Bollinger width is band distance divided by absolute basis; Keltner width is normalized identically. ta.percentrank maps each to 0–100; inversion gives high depth to historically narrow envelopes.
Average depth receives a 0.60-to-1.00 agreement factor based on depth distance. Above threshold, a bar counter starts. Progress toward Minimum Compression Bars raises energy from 75% to 100%, so Primed requires depth and residence.
Release velocity is the one-bar decline in compression; ATR slope compares current ATR with its earlier value. The first confirmed bar outside mature compression must pass both thresholds. Expansion force blends capped velocity, positive slope, and ATR percentile. It persists only while ATR rises and never beyond Maximum Expansion Hold. No future or external data is requested.
How Multiple Indicators Work Together
This is one sequence, not an unrelated blend. Bollinger observes dispersion; Keltner observes true range. Ranks create comparability, agreement prevents domination, and dwell stores persistence. Release velocity measures discharge; ATR slope tests acceleration. DNA lines expose inputs while the hero field and dashboard explain state.
Trading Ideas and Insights
A rising positive field means volatility is unusually compressed versus history. Primed is persistent compression, not direction. The expansion diamond confirms qualified release but cannot predict its direction. Repeated starts without maturity can mark unstable ranges; long dwell followed by weak release can mean normalization. These are contexts, not entry or performance claims.
Unique Aspects
The components are standard; the lifecycle is the contribution. Two normalized depths must agree, compression accumulates residence memory, and expansion requires release from maturity plus range acceleration. The charge/release layout makes order visible. Implementation is independent; no retrieved source was used, reconstructed, translated, or altered.
How to Use
- Allow the percentile lookback to warm up.
- Read the positive field as compression energy and compare DNA lines for agreement.
- Treat Primed as volatility context, not direction.
- Use the negative field and confirmed diamond for a qualified release.
- Confirm direction, liquidity, execution, and risk independently.
- Disable secondary layers for a cleaner view.
Customization
Envelope Length sets the window; multipliers alter raw widths; rank lookback controls context and adaptation.
Compression Threshold controls narrowness, while Minimum Compression Bars adds maturity and lag. Release Velocity controls discharge. ATR Slope settings define acceleration: lower values react faster but admit weaker releases. Maximum Expansion Hold caps persistence. Reevaluate settings across markets and timeframes.
Assumptions and Limitations
History must be representative. Percentiles are relative, both envelopes share price data, and ATR is directionless. Expansion cannot determine breakout direction or continuation.
Live-bar values and phases may change before close; markers and alerts require barstate.isconfirmed. There is no lookahead, negative offset, external symbol, or higher-timeframe request, but the model is lagging and parameter-sensitive. Gaps, illiquidity, regime breaks, and short history reduce usefulness. Orders, fees, slippage, and profitability are outside scope.
Conclusion
Compression Expansion Map [Pineify] replaces a Boolean squeeze with an inspectable lifecycle. Depth measures charge, dwell measures maturity, and qualified release plus ATR acceleration measures expansion without claiming direction or outcomes.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
🚀🚀🚀 Pineify - pineify.app
Essential Toolkit for Every Trader
- AI Pine Script Generator
- Finance AI Agent
- AI Stock Picker
- Pine Script Visual Editor
- Invited indicators
- Strategy Optimizer
- Trading Journal
- Backtest Report
Essential Toolkit for Every Trader
- AI Pine Script Generator
- Finance AI Agent
- AI Stock Picker
- Pine Script Visual Editor
- Invited indicators
- Strategy Optimizer
- Trading Journal
- Backtest Report
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
🚀🚀🚀 Pineify - pineify.app
Essential Toolkit for Every Trader
- AI Pine Script Generator
- Finance AI Agent
- AI Stock Picker
- Pine Script Visual Editor
- Invited indicators
- Strategy Optimizer
- Trading Journal
- Backtest Report
Essential Toolkit for Every Trader
- AI Pine Script Generator
- Finance AI Agent
- AI Stock Picker
- Pine Script Visual Editor
- Invited indicators
- Strategy Optimizer
- Trading Journal
- Backtest Report
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.