OPEN-SOURCE SCRIPT
已更新 Inverse Fair Value Gaps (Wicks) v6 — Sticky

This indicator marks iVFG and FVG for all the trading you need
版本注释
UPDATED: This now shows proper FVG Bullish & Bearish + IVFG 版本注释
# **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 |
---
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。