OPEN-SOURCE SCRIPT
Mis à jour

Inverse Fair Value Gaps (Wicks) v6 — Sticky

133
This indicator marks iVFG and FVG for all the trading you need
Notes de version
UPDATED: This now shows proper FVG Bullish & Bearish + IVFG
Notes de version
# **Wick-Based FVG + IFVG Script – User Guide**

## **Overview**

This script identifies **Fair Value Gaps (FVGs)** and **Inverse FVGs (IFVGs)** using **wicks (high/low)** rather than candle bodies. It helps traders identify price gaps that could act as potential support/resistance or trigger reversals.

* **FVGs**: Unfilled gaps in price caused by rapid price movement.
* **IFVGs**: Occur when price breaks beyond a previous FVG, signaling potential continuation or reversal.

---

## **Inputs**

| Setting | Description |
| ----------------- | ------------------------------------------------------------ |
| Show FVGs | Toggle to display bullish and bearish FVGs. |
| Show IFVGs | Toggle to display inverse FVGs when price breaks past FVGs. |
| Border Width | Width of the boxes drawn on the chart. |
| Bullish FVG Color | Color of bullish FVG boxes. |
| Bearish FVG Color | Color of bearish FVG boxes. |
| Bull IFVG Color | Color of bullish IFVG boxes (when price breaks bearish FVG). |
| Bear IFVG Color | Color of bearish IFVG boxes (when price breaks bullish FVG). |

---

## **How It Works**

### **1. Detecting FVGs**

* **Bullish FVG** (Gap Down)

* Detected when: `high[2] < low`
* Box drawn from **top = high[2]** to **bottom = low**
* **Bearish FVG** (Gap Up)

* Detected when: `low[2] > high`
* Box drawn from **top = low[2]** to **bottom = high**

> Boxes are drawn using **wick extremes**, not candle bodies.

---

### **2. Detecting IFVGs**

* **Bullish IFVG**

* Triggered when price breaks **below a previous bullish FVG**.
* Box drawn covering the FVG zone to show price reversal area.
* **Bearish IFVG**

* Triggered when price breaks **above a previous bearish FVG**.
* Box drawn covering the FVG zone to highlight potential reversal.

---

### **3. Labels**

* Each FVG or IFVG has a label:

* `"FVG"` for regular FVGs
* `"Bullish IFVG"` / `"Bearish IFVG"` for inverse FVGs
* Labels are placed in the **middle of the box** for visibility.

---

## **Usage Instructions**

1. **Add Script to Chart**

* Copy the full script into TradingView Pine Editor.
* Set version to **v6** at the top: `//version=6`
* Click **Add to Chart**.

2. **Configure Inputs**

* Open the **Settings** panel for the script.
* Toggle colors, border width, and whether FVGs/IFVGs are displayed.

3. **Interpret the Boxes**

* **Green box** → Bullish FVG (gap down)
* **Red box** → Bearish FVG (gap up)
* **Teal box** → Bullish IFVG (price breaks bearish FVG)
* **Orange box** → Bearish IFVG (price breaks bullish FVG)

4. **Trade Signals (Optional)**

* **Bullish FVG**: Potential long zone if price returns to gap.
* **Bearish FVG**: Potential short zone if price returns to gap.
* **IFVGs**: Signal momentum continuation in the direction of the break.

---

## **Tips**

* Use in combination with **price action** or **trend analysis** for better signals.
* FVGs are more reliable in **high volatility zones** (e.g., after news or breakouts).
* Adjust **colors** for visibility against your chart background.
* **Sticky FVGs**: Once drawn, FVG boxes remain until completely filled.

---

## **Troubleshooting**

* **Error: `end of line without line continuation`**

* Use **single-line `box.new()`** calls instead of multi-line.
* Example:

```pinescript
b = box.new(left=bar_index-2, top=a_high, right=bar_index, bottom=c_low, bgcolor=bull_fvg_color, border_color=color.new(color.green,0), border_width=border_width)
```

* **Boxes not appearing**

* Ensure **Show FVGs / Show IFVGs** inputs are enabled.
* Script only draws boxes **after bar 2** (needs at least 3 bars).

---

## **Example Chart Layout**

| Box Color | Meaning |
| --------- | ------------ |
| Green | Bullish FVG |
| Red | Bearish FVG |
| Teal | Bullish IFVG |
| Orange | Bearish IFVG |

---


Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.