OPEN-SOURCE SCRIPT
PI Band

# PI Band
PI ATR Compression Breakout is a volatility expansion and breakout detection tool built around a custom PI-powered energy model.
Unlike traditional squeeze indicators that rely solely on price volatility, this script combines **ATR (volatility)**, **OBV momentum (volume flow)** and a **PI-based energy calculation** to identify compression phases before potential directional breakouts.
---
## How The Energy Engine Works
The core of the indicator is the proprietary PI ATR OBV Energy Model.
The calculation starts by measuring:
* ATR volatility
* OBV rate of change
* PI-scaled volatility area
ATR is transformed into a circular energy representation using:
PI × ATR²
This value is then combined with the square root of OBV momentum, creating an energy stream that reflects both volatility expansion and volume participation.
The resulting energy is normalized and smoothed to produce a dynamic market pressure score ranging between 0 and 100.
---
## PI Power
The normalized energy drives a variable called **PI Power**.
Higher energy levels increase PI Power.
Lower energy levels reduce PI Power.
Instead of using a fixed ATR channel, the indicator dynamically adjusts channel width according to the current market energy state.
This allows the bands to expand during strong directional moves and contract during low-energy environments.
---
## Compression Detection
The script continuously compares the active PI ATR value against its historical average.
When PI ATR falls significantly below its own average, a compression state is detected.
Compression represents:
* Reduced volatility
* Contracting market activity
* Energy accumulation
* Potential breakout preparation
Compression zones are highlighted in purple to make them easy to identify.
---
## Dynamic PI ATR Channel
The indicator builds a volatility channel around a Center EMA.
Components:
* Center EMA
* Dynamic PI ATR Upper Band
* Dynamic PI ATR Lower Band
Because channel width is driven by PI Power, the structure automatically adapts to changing market conditions.
This creates a responsive framework that behaves differently from static volatility bands.
---
## Breakout Logic
A breakout is only considered valid when price escapes a previously compressed structure.
### Long Break
A LONG BREAK is generated when:
* Previous bar was in compression
* Price closes above the upper PI ATR band
* Price remains above the center trend line
### Short Break
A SHORT BREAK is generated when:
* Previous bar was in compression
* Price closes below the lower PI ATR band
* Price remains below the center trend line
This approach attempts to focus on expansion moves that emerge directly from volatility contraction.
---
## Release Signal
The indicator also identifies compression releases.
A release occurs when:
* Compression ends
* PI ATR begins expanding again
These events are marked with purple release markers and can be used as early warnings that market conditions are changing.
---
## Visual Features
✔ Dynamic PI ATR volatility channel
✔ Compression highlighting
✔ Long and Short breakout signals
✔ Release markers
✔ Adaptive bar coloring
✔ Real-time information panel
✔ Alert conditions for breakout and release events
---
## Information Panel
The panel displays:
* Current Energy Value
* PI Power
* Active PI ATR
* Historical PI ATR Average
* Current Market State
Possible states:
* COMPRESS
* BULL
* BEAR
* NORMAL
* LONG BREAK
* SHORT BREAK
---
## Intended Use
PI ATR Compression Breakout is designed for traders who want to monitor:
* Volatility contractions
* Energy accumulation phases
* Expansion breakouts
* Trend continuation opportunities
The indicator is not intended to predict future price movement. Instead, it aims to visualize when market energy shifts from compression into expansion and to highlight potential breakout environments.
PI ATR Compression Breakout is a volatility expansion and breakout detection tool built around a custom PI-powered energy model.
Unlike traditional squeeze indicators that rely solely on price volatility, this script combines **ATR (volatility)**, **OBV momentum (volume flow)** and a **PI-based energy calculation** to identify compression phases before potential directional breakouts.
---
## How The Energy Engine Works
The core of the indicator is the proprietary PI ATR OBV Energy Model.
The calculation starts by measuring:
* ATR volatility
* OBV rate of change
* PI-scaled volatility area
ATR is transformed into a circular energy representation using:
PI × ATR²
This value is then combined with the square root of OBV momentum, creating an energy stream that reflects both volatility expansion and volume participation.
The resulting energy is normalized and smoothed to produce a dynamic market pressure score ranging between 0 and 100.
---
## PI Power
The normalized energy drives a variable called **PI Power**.
Higher energy levels increase PI Power.
Lower energy levels reduce PI Power.
Instead of using a fixed ATR channel, the indicator dynamically adjusts channel width according to the current market energy state.
This allows the bands to expand during strong directional moves and contract during low-energy environments.
---
## Compression Detection
The script continuously compares the active PI ATR value against its historical average.
When PI ATR falls significantly below its own average, a compression state is detected.
Compression represents:
* Reduced volatility
* Contracting market activity
* Energy accumulation
* Potential breakout preparation
Compression zones are highlighted in purple to make them easy to identify.
---
## Dynamic PI ATR Channel
The indicator builds a volatility channel around a Center EMA.
Components:
* Center EMA
* Dynamic PI ATR Upper Band
* Dynamic PI ATR Lower Band
Because channel width is driven by PI Power, the structure automatically adapts to changing market conditions.
This creates a responsive framework that behaves differently from static volatility bands.
---
## Breakout Logic
A breakout is only considered valid when price escapes a previously compressed structure.
### Long Break
A LONG BREAK is generated when:
* Previous bar was in compression
* Price closes above the upper PI ATR band
* Price remains above the center trend line
### Short Break
A SHORT BREAK is generated when:
* Previous bar was in compression
* Price closes below the lower PI ATR band
* Price remains below the center trend line
This approach attempts to focus on expansion moves that emerge directly from volatility contraction.
---
## Release Signal
The indicator also identifies compression releases.
A release occurs when:
* Compression ends
* PI ATR begins expanding again
These events are marked with purple release markers and can be used as early warnings that market conditions are changing.
---
## Visual Features
✔ Dynamic PI ATR volatility channel
✔ Compression highlighting
✔ Long and Short breakout signals
✔ Release markers
✔ Adaptive bar coloring
✔ Real-time information panel
✔ Alert conditions for breakout and release events
---
## Information Panel
The panel displays:
* Current Energy Value
* PI Power
* Active PI ATR
* Historical PI ATR Average
* Current Market State
Possible states:
* COMPRESS
* BULL
* BEAR
* NORMAL
* LONG BREAK
* SHORT BREAK
---
## Intended Use
PI ATR Compression Breakout is designed for traders who want to monitor:
* Volatility contractions
* Energy accumulation phases
* Expansion breakouts
* Trend continuation opportunities
The indicator is not intended to predict future price movement. Instead, it aims to visualize when market energy shifts from compression into expansion and to highlight potential breakout environments.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.