[TehThomas] - Aligned Timeframe Fair Value Gaps█ OVERVIEW
This indicator automatically detects and displays Fair Value Gaps (FVGs) from higher timeframes on your current chart, following ICT (Inner Circle Trader) methodology. It intelligently selects the optimal higher timeframe based on your current chart timeframe and tracks both filled and unfilled gaps with full visual customization, including dynamic shrinking gaps and midline references.
█ KEY FEATURES
✓ Automatic Timeframe Alignment
- Intelligently selects higher timeframe based on current chart (1min→15min, 5min→1H, 1H→Daily, etc.)
- Uses confirmed/closed HTF bars only for reliable gap detection
- Displays timeframe label on each FVG box for clarity
✓ Dynamic Gap Management
- Optional dynamic (shrinking) gaps that contract as price fills them partially
- Automatic removal when gaps are fully filled by price
- Tracks up to 200 historical FVGs with intelligent visibility management
✓ Advanced Display Controls
- Show only unfilled gaps (reduces chart clutter)
- Configurable box extension length into future bars
- Optional midline display with customizable style (solid/dashed/dotted)
- Fully customizable colors for bullish/bearish gaps, borders, and labels
█ HOW IT WORKS
The indicator monitors the aligned higher timeframe and detects three-candle patterns where price creates an imbalance, areas where aggressive buying or selling left gaps that were never properly filled. When a bullish FVG forms (gap between HTF bar lows and highs), it indicates rapid upward price movement that skipped price levels, creating a zone where price may return to seek "fair value". Bearish FVGs work inversely, forming during aggressive downward moves.
The indicator places boxes starting from where the gap actually formed (2 HTF bars ago) and extends them forward. As new bars form, it continuously checks if price has entered or filled each gap. In dynamic mode, gaps shrink in real-time as price partially fills them. The visibility system ensures only the most recent unfilled gaps are displayed, keeping your chart clean while maintaining historical data.
█ SETTINGS
Boxes Group:
- Extend boxes: Number of bars to project gaps into the future (default: 20)
- Min Gap Size (%): Minimum percentage size to filter small/noise gaps (default: 0%)
- Dynamic (shrinking) gaps: Enable gaps to shrink as price fills them partially
- Max Unfilled Gaps to Display: Limit visible unfilled gaps on chart (default: 10)
- Max FVGs in History: Total gaps stored in memory for tracking (50-200, affects performance)
Colors Group:
- Bullish Gap Color: Fill color for bullish FVGs
- Bearish Gap Color: Fill color for bearish FVGs
- Gap Border Color: Border color for all gap boxes
Midline Group:
- Show Midline: Display 50% level line through each gap
- Midline Color: Color of the midline
- Midline Style: Visual style (Solid/Dashed/Dotted)
Label Group:
- Show FVG Label: Display timeframe label on each gap box
- Label Text Color: Color of label text
- Label Size: Text size (Tiny/Small/Normal/Large)
█ HOW TO USE
1. Apply to any timeframe - The indicator automatically selects the appropriate higher timeframe for analysis
2. Identify imbalance zones - FVG boxes show areas where price moved too quickly, creating inefficiency that often acts as a magnet for future price action
3. Use for retracement entries - Wait for price to return to an unfilled FVG after a Break of Structure (BOS) or Market Structure Shift (MSS) for high-probability entry zones
4. Watch midlines - The 50% level of each gap often provides the strongest reaction point
5. Monitor gap filling - When gaps are filled, they signal that the imbalance has been resolved; dynamic mode shows partial fills in real-time
█ TRADING STRATEGY EXAMPLES
Trend Continuation Strategy:
After a strong bullish move creates multiple bullish FVGs, wait for price to retrace into the nearest unfilled FVG, then enter long positions expecting continuation. The FVG acts as a support zone where institutional buyers may re-enter.
Confluence Trading:
Combine FVGs with other ICT concepts like Order Blocks, liquidity grabs, or Premium/Discount zones. The strongest setups occur when an FVG aligns with multiple confluence factors, increasing probability of successful retracement entries.
Breakout Confirmation:
After a Break of Structure, look for price to return to the FVG created during the breakout candle. This retest provides a lower-risk entry point with clear invalidation levels (below/above the gap).
█ IDEAL FOR
- ICT (Inner Circle Trader) methodology practitioners
- Smart Money Concepts (SMC) traders seeking institutional footprints
- Multi-timeframe analysis traders who want higher timeframe context on lower timeframe charts
- Price action traders focusing on supply-demand imbalances
- Swing and intraday traders seeking high-probability retracement zones
- Traders who value clean, organized chart visualization with controlled gap display
█ TECHNICAL SPECIFICATIONS
- Pine Script Version: 6
- Chart Type: Overlay indicator
- Maximum Boxes: 500
- Maximum Lines: 500 (for midlines)
- Lookback Period: 2000 bars
- HTF Data: Uses confirmed/closed bars with lookahead to avoid repainting
- Memory Management: Stores up to 200 historical FVGs with intelligent visibility control
- Update Frequency: Real-time gap tracking and dynamic adjustment on every bar
█ NOTES & DISCLAIMERS
- FVGs represent areas of price imbalance, not guaranteed reversal or continuation zones
- Higher timeframe gaps may take significant time to be filled or may never fill in strong trending markets
- Dynamic gaps provide visual feedback but increase computational load; disable for better performance on slower devices
- Max history setting affects performance: higher values enable more unfilled gaps but require more processing power
- This indicator works best when combined with proper market structure analysis, liquidity concepts, and risk management
- Past performance of FVG fills does not guarantee future results
- Always use appropriate position sizing and stop losses when trading FVG retracements
Pine Script® indicator






















