PROTECTED SOURCE SCRIPT

Allyhshn - FVG Classifier

25
## Allyhshn – FVG Classifier

### Technical Specifications & Methodology

### Overview

**Allyhshn – FVG Classifier** is a multi-timeframe Fair Value Gap (FVG) detection, ranking, and visualization indicator built in Pine Script® v6.
It is designed to identify ICT-style three-candle imbalances across multiple timeframes, dynamically rank them by contextual relevance, and display only the most actionable FVG zones on the chart with strong performance safeguards.

The indicator does **not** predict price direction. Instead, it classifies and prioritizes existing imbalance zones based on structural, volatility, trend, and temporal factors.

---

## 1. FVG Detection Logic

### Definition

The indicator uses a strict **3-candle ICT imbalance model**:

* **Bullish FVG**
Formed when:
`Low (current candle) > High (2 candles ago)`
Zone range:

* Bottom = High[2]
* Top = Low

* **Bearish FVG**
Formed when:
`High (current candle) < Low (2 candles ago)`
Zone range:

* Bottom = High
* Top = Low[2]

Each detected FVG is stored as a price zone and tracked independently.

---

## 2. Multi-Timeframe Architecture

### Fixed 5-Timeframe Model

The indicator always processes **exactly five timeframes per bar**, ensuring deterministic behavior and predictable performance.

### Mode Selection

* **Auto Mode**
Timeframes are automatically selected based on:

* Current chart timeframe
* Trading regime (Scalping, Intraday, Swing, Position)

* **Manual Mode**
The user explicitly defines all five timeframes.

### Regime Influence

Trading regimes bias the timeframe selection:

* **Scalping**: Lower timeframes emphasized
* **Intraday**: Balanced LTF/MTF/HTF mix
* **Swing / Position**: Higher timeframes prioritized (Daily, Weekly, Monthly)

---

## 3. Filters and Validation

### Minimum Size Filter

* FVG size is normalized by ATR.
* Zones smaller than a user-defined ATR multiple are ignored.
* Prevents noise and micro-imbalances.

### Trend Alignment (Optional)

* Uses an EMA-based trend filter.
* Bullish FVGs are optionally restricted to uptrends.
* Bearish FVGs are optionally restricted to downtrends.

---

## 4. Scoring & Priority System

Each FVG receives a **dynamic score** representing contextual priority, recalculated every bar.

### Score Components

The final score is a multiplicative composite of:

1. **Timeframe Weight**

* Higher timeframes receive higher structural importance.
* Monthly > Weekly > Daily > Intraday > Seconds.

2. **Distance to Price**

* Zones closer to current price are prioritized.
* Distance normalized by ATR.

3. **Zone Size**

* Moderate-sized imbalances score higher than very small ones.
* Normalized and softly capped.

4. **Trend Alignment**

* Aligned zones receive a boost.
* Counter-trend zones are penalized, not discarded.

5. **Age Decay**

* Older zones remain valid but lose urgency over time.
* Smooth decay with a multi-hour half-life effect.

6. **Session Boost (Optional)**

* Priority boost during user-defined high-liquidity sessions.

The score acts as a **probability proxy**, not a prediction.

---

## 5. Mitigation Logic

Each FVG is monitored for mitigation using one of three user-defined rules:

* **Touch**: Any price overlap with the zone
* **Half**: Price reaches the midpoint of the zone
* **Full**: Entire zone is traded through

Once mitigated:

* The zone is flagged internally
* The visual box is removed
* The data remains available for ranking logic

---

## 6. Memory & Performance Management

### Controlled Storage

* Maximum number of stored FVGs is capped.
* Oldest entries are removed automatically.

### Draw Limit

* Only the **highest-ranked unmitigated FVGs** are displayed.
* Lower-priority zones are visually faded or hidden.
* Prevents chart clutter and performance degradation.

### Array Safety

* All array operations are size-checked.
* Prevents out-of-bounds errors in real-time and historical bars.

---

## 7. Visualization

### Box Rendering

* FVGs are drawn as shaded rectangles.
* Color-coded by direction:

* Bullish and bearish zones use distinct colors.
* Boxes extend a configurable number of bars into the future.

### Transparency Logic

* High-priority zones are emphasized.
* Lower-priority zones are automatically faded.

---

## 8. Priority Table (Optional)

An optional on-chart table displays the **top-ranked unmitigated FVGs**, including:

* Priority rank
* Timeframe
* Direction
* Average price of the zone
* Size (ATR-normalized)
* Current score

The table is rebuilt only on the last bar to preserve performance.

---

## 9. Alerts

### Proximity Alert

An optional alert triggers when:

* Price approaches the midpoint of the **highest-priority FVG**
* Distance threshold is ATR-based and configurable

Alerts are evaluated globally and safely outside local scopes.

---

## 10. Intended Use & Limitations

### Intended Use

* Market structure analysis
* Liquidity-based zone mapping
* Contextual decision support
* Confluence with other execution models

### Not Intended For

* Standalone trade signals
* Price prediction
* Automated execution without confirmation

## 11. Account Compatibility

* Does not require proprietary order book or footprint data.
* Works on all TradingView accounts.
* Uses only publicly available volume information.

---

## Summary

**Allyhshn – FVG Classifier** is a structured, performance-conscious FVG classification engine.
It focuses on **ranking relevance rather than quantity**, making it suitable for scalping, intraday, and higher-timeframe structural analysis without overwhelming the chart or the Pine runtime.

---

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.