OPEN-SOURCE SCRIPT
Atualizado

Multi-TF FVG-TEX.P

1 039
# Multi-TF FVG [A] All TFs by TEX.P

## Overview

Multi-TF FVG is a powerful Fair Value Gap detector that scans **11 timeframes simultaneously** — from M1 to W1 — all on a single chart. Unlike most FVG indicators that only detect gaps on the chart's current timeframe, this indicator builds higher-timeframe candles internally and scans every timeframe above your chart TF without using a single `request.security()` call. This means **zero repainting**, fast performance, and reliable HTF data.

The indicator is designed for traders who use multi-timeframe confluence to find high-probability trade entries — when multiple timeframes have overlapping FVG zones at the same price level, it signals a strong area of institutional interest.

---

## ⚡ FVG Gate Dashboard

The real-time **FVG Gate** dashboard (top-right) tells you at a glance:

- **BUY**: Shows which bullish FVG zones the current price is sitting inside, with the timeframe names (e.g., `✅ M5+H1+H4(3)`)
- **SELL**: Shows which bearish FVG zones the current price is inside (e.g., `✅ M10+D1(2)`)
- **MITIGATED**: Lists which timeframes had FVGs that have been fully mitigated (closed through) by subsequent price action (e.g., `⚠ M5+M10(2)`)
- **Zones**: Total count of active (unmitigated) FVG zones currently displayed on the chart

This gives you an instant read on multi-timeframe confluence — when BUY shows 3+ timeframes, you're sitting in a strong demand zone. When SELL shows 3+ timeframes, you're in a strong supply zone.

---

## 🎨 FVG Colour Legend

The colour legend panel sits directly below the Gate dashboard, showing all 11 timeframes with their assigned colours. Active timeframes display in UPPERCASE with their colour; disabled ones show in lowercase gray. This helps you instantly identify which timeframe each FVG zone on the chart belongs to.

---

## How It Works

### Zero request.security() Architecture

Instead of calling `request.security()` for each higher timeframe (which introduces repainting and is limited to 40 calls), this indicator uses `timeframe.change()` to detect when a new candle starts on each HTF. It builds and maintains candle arrays (open, high, low, close) for all 10 higher timeframes bar-by-bar as your chart updates. On the last bar, it scans all accumulated candles backward to find FVG patterns.

### FVG Detection Logic

A **Fair Value Gap** is identified using the classic 3-candle pattern:

- **Bullish FVG**: Candle 1's low > Candle 3's high (gap up — price moved so fast that sellers couldn't fill the space between candles 1 and 3)
- **Bearish FVG**: Candle 1's high < Candle 3's low (gap down — price dropped so fast that buyers couldn't fill the space)

The gap zone is the area between these two price levels, centred on Candle 2.

### Strict Mitigation

An FVG is considered **mitigated** (filled) only when a subsequent candle's **close** fully passes through the zone:

- Bullish FVG mitigated when close < bottom of zone
- Bearish FVG mitigated when close > top of zone

Wicks passing through the zone do NOT count — only body closes. Each timeframe's FVG is checked for mitigation using its own timeframe's candle closes, not lower timeframe data. This ensures accurate, timeframe-consistent mitigation tracking.

### Backward Scanning

All scanning happens on `barstate.islast` (the final bar only), which means:

- Minimal CPU usage — no per-bar calculations
- All FVGs within the lookback range are found in one pass
- The chart TF scans using `close[N]` / `high[N]` / `low[N]` references
- Higher TFs scan through their internally-built candle arrays

---

## Timeframes Supported

| Timeframe | Code | Default Colour |
|-----------|------|---------------|
| 1 Minute | M1 | Pink |
| 3 Minute | M3 | Orange |
| 5 Minute | M5 | Green |
| 10 Minute | M10 | Blue |
| 15 Minute | M15 | Purple |
| 30 Minute | M30 | Light Purple |
| 1 Hour | H1 | Cyan |
| 2 Hour | H2 | Peach |
| 4 Hour | H4 | Light Red |
| Daily | D1 | Yellow |
| Weekly | W1 | Light Blue |

The indicator automatically determines which timeframes are "higher" than your chart TF and only scans those. For example, on a 5-minute chart, it will scan M5 (chart TF), M10, M15, M30, H1, H2, H4, D1, and W1 — but skip M1 and M3 since they're lower than the chart TF.

---

## Settings

### Timeframe Toggles
Enable or disable any of the 11 timeframes individually. Disabled timeframes won't be scanned or displayed.

### Display
- **Show Labels**: Toggle the text labels (e.g., "H1 Bull", "M5 Bear") on each FVG zone
- **Show 50% Line**: Toggle the midpoint line inside each FVG box (commonly used as an entry/reaction level)
- **Box extends past last bar**: How far right the FVG boxes extend beyond the last candle (default: 5 bars)
- **Lookback bars**: How many chart bars to scan backward for FVGs (default: 2000, range: 100–5000)

### Colors and Transparency
Each timeframe has its own customisable base colour and transparency level. Higher timeframes default to lower transparency (more visible) since they carry more weight.

### Panels
- **Show Color Legend**: Toggle the FVG Colour Legend panel
- **Show Gate Panel**: Toggle the FVG Gate dashboard
- **Panel Font Size**: Choose from Tiny, Small, Normal, Large, or Huge
- **Gate Buffer pips**: How many pips around an FVG zone still count as "inside" for the Gate dashboard (default: 10)
- **Pip Size**: Pip size for your instrument (default: 0.1 — adjust for forex, crypto, etc.)

---

## How to Use for Trading

### Multi-Timeframe Confluence
The strongest trade setups occur when multiple timeframes have overlapping FVG zones at the same price level. Watch the Gate dashboard:

- **3+ timeframes showing BUY** = Strong demand zone, look for long entries
- **3+ timeframes showing SELL** = Strong supply zone, look for short entries
- **Mixed BUY and SELL** = Contested zone, wait for clarity

### The 50% Line
The midpoint (50% line) of each FVG is a key level where price often reacts. Many institutional traders use it as a precise entry point — entering longs at the 50% of a bullish FVG, or shorts at the 50% of a bearish FVG.

### Mitigation Tracking
The MITIGATED line in the Gate tells you which timeframe FVGs have been filled. If H4 and D1 FVGs are mitigated but M5 is still active, the remaining M5 zone may be weaker since the higher timeframe structure has been invalidated.

---

## Performance Notes

- **Zero `request.security()` calls** — uses `timeframe.change()` for HTF candle building
- **Scans only on the last bar** (`barstate.islast`) — negligible CPU usage during live trading
- **Respects TradingView limits**: max 500 boxes, 500 labels, 500 lines
- `calc_bars_count` is set to 2000 to match the default lookback

---

## Tips

- On lower timeframes (M1–M5), you'll see many FVG zones. Consider disabling the lowest TFs and focusing on M15+ for cleaner charts
- Increase the Gate Buffer pips for volatile instruments like BTC to catch zones that price is approaching
- The indicator works on any instrument — stocks, forex, crypto, indices, commodities
- Adjust the Pip Size setting to match your instrument (e.g., 0.0001 for forex pairs, 0.01 for stocks, 0.1 for crypto)
- Use the transparency settings to make lower TF zones more transparent so higher TF zones stand out

---

**Built with Pine Script v6. No repainting. No request.security(). Pure multi-timeframe analysis.** Anyone who want MT5 version, I'm selling it for USD100
Notas de Lançamento
PAdding added for the Dashboard
Notas de Lançamento
Bug FIXES. SELL NOW | BUY NOW shows in the fvg gate.
Notas de Lançamento
More update from bugs
Notas de Lançamento
Bug Fixes.

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.