OPEN-SOURCE SCRIPT

1M IFVG Execution - V4.1 First Active

777
# 1M IFVG Execution – V4.1 First Active

The **1M IFVG Execution – V4.1 First Active** indicator is a specialized one-minute execution framework designed to identify and maintain only the first valid active Inverse Fair Value Gap (IFVG) structure in each direction.

Rather than displaying every historical IFVG detected on the chart, the indicator operates as a directional state machine. It continuously monitors native one-minute Fair Value Gaps, detects their conversion into IFVGs, filters consecutive source-gap structures, and maintains only the currently actionable bullish and bearish first-active zones.

A bullish and bearish IFVG may exist simultaneously because both directional states are processed independently.

## Core IFVG Logic

The indicator begins with conventional three-candle Fair Value Gap structures.

A bullish source FVG is detected when:

`low > high[2]`

If price subsequently produces a confirmed candle close below the lower boundary of that bullish FVG, the structure converts into a **bearish IFVG**.

A bearish source FVG is detected when:

`high < low[2]`

If price subsequently produces a confirmed candle close above the upper boundary of that bearish FVG, the structure converts into a **bullish IFVG**.

The default minimum source-gap size is **0.75 points**, although this value can be configured in the indicator settings.

## First-Active State Machine

The primary purpose of V4.1 is not simply to identify IFVGs, but to determine which IFVG is currently structurally relevant.

Only the first qualifying active bullish IFVG and first qualifying active bearish IFVG are maintained.

Once an IFVG becomes active, additional conversions originating from older source FVGs in the same directional sequence are ignored. A replacement must originate from a genuinely new source-FVG sequence created after the currently active structure was established or reset.

This prevents second, third, or stale historical conversions from continuously replacing the primary execution structure.

## Consecutive FVG Structure Rules

Source FVGs are classified into runs according to whether they form on consecutive one-minute candles.

A single qualifying source FVG may become an IFVG immediately once its conversion condition is confirmed.

Exactly two consecutive same-direction FVGs are treated as one structural sequence. The indicator waits until both FVGs have converted before activating the IFVG.

When two members belong to the sequence, the FVG that converts last becomes the selected active structure. If both convert on the same candle, the first-created member is selected.

Sequences containing three or more consecutive same-direction source FVGs are rejected by the model.

This filtering mechanism is specifically intended to suppress congested multi-gap sequences and retain cleaner first-active structures.

## Active-Zone Invalidation

The active zone remains valid until price invalidates it by confirmed candle close.

A bullish IFVG is invalidated when a confirmed one-minute candle closes below its lower boundary.

A bearish IFVG is invalidated when a confirmed one-minute candle closes above its upper boundary.

Invalidating an active structure does not automatically erase newer source-FVG information that may already be developing. Those newer structures remain eligible to produce the next first-active IFVG.

## Boundary and Consequent Encroachment

Each active IFVG provides two principal execution references:

**Boundary**
For a bullish IFVG, the execution boundary is the upper edge of the zone.

For a bearish IFVG, the execution boundary is the lower edge of the zone.

**CE – Consequent Encroachment**
CE represents the midpoint of the active IFVG:

`CE = (Upper Boundary + Lower Boundary) / 2`

The indicator can display both Boundary and CE price labels directly on the active structure.

The CE level may additionally be displayed as a solid, dashed, or dotted horizontal line.

## First-Touch Monitoring

The indicator independently tracks the first subsequent interaction with both the Boundary and CE of the active IFVG.

Touch detection only begins after the IFVG has formed, preventing the conversion candle itself from being incorrectly registered as a retracement into the newly activated structure.

After the first qualifying touch occurs, the respective state is recorded so repeated interactions do not generate duplicate first-touch events.

## Session Architecture

The indicator uses New York time and separates internal structural tracking from visible execution hours.

Default internal state-tracking session:

**07:00–16:00 ET**

Default display and alert session:

**09:30–16:00 ET**

The earlier internal tracking window allows an IFVG created before the visible session—for example, shortly before 09:30—to remain active and carry into the display window if it has not been invalidated.

At the beginning of a new state-tracking session, the previous session's source structures and active states are reset.

## Chart Presentation

The indicator deliberately avoids maintaining a historical inventory of IFVG boxes.

At any moment, the model itself determines whether the chart should contain:

* no active IFVG,
* one active directional IFVG, or
* one bullish and one bearish IFVG simultaneously.

Active zones dynamically project forward while remaining valid.

Users can configure:

* Bullish and bearish IFVG colors
* Zone transparency
* Border transparency and width
* Forward projection distance
* Box anchoring
* CE visibility
* CE line color
* CE line width
* CE line style
* Boundary and CE price labels
* Price-label position
* Label size
* CE spacing around labels
* Zone text visibility

## Alert System

The indicator provides dedicated TradingView alert conditions for:

* New bullish first-active IFVG
* New bearish first-active IFVG
* New IFVG in either direction
* Bullish IFVG invalidation
* Bearish IFVG invalidation
* First bullish Boundary touch
* First bearish Boundary touch
* Boundary touch in either direction
* First bullish CE touch
* First bearish CE touch
* CE touch in either direction

Dynamic `alert()` messages can additionally report the instrument, active Boundary price, CE price, and invalidation level.

## Intended Use

This indicator is designed as an execution-structure tool rather than a conventional historical FVG plotting utility.

Its objective is to reduce chart congestion and isolate the first structurally relevant IFVG produced by a valid source-FVG sequence.

It is particularly suited to traders who want a deterministic framework for monitoring:

* first-active one-minute IFVG structures,
* directional retracement zones,
* Boundary interaction,
* Consequent Encroachment interaction,
* structural invalidation, and
* transition into genuinely new IFVG sequences.

## Important

The indicator is designed specifically for the **1-minute timeframe**. Its internal execution logic requires native one-minute candles and will not operate as intended when applied to another chart timeframe.

The indicator does not predict future price movement and does not independently constitute a trading system. It identifies and manages specific market structures according to the programmed IFVG rules. Risk management, directional context, execution methodology, and trade selection remain the responsibility of the user.

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.