OPEN-SOURCE SCRIPT

PI Band

431
# 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.

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน