OPEN-SOURCE SCRIPT
Aggiornato Inverse Fair Value Gaps (Wicks) v6 — Sticky

This indicator marks iVFG and FVG for all the trading you need
Note di rilascio
UPDATED: This now shows proper FVG Bullish & Bearish + IVFG Note di rilascio
# **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 |
---
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.