OPEN-SOURCE SCRIPT
MSS + Multi FVG Tracker

MSS + Multi FVG Tracker
Description
An advanced institutional trading tool that combines Market Structure Shift (MSS) detection with multi-level Fair Value Gap (FVG) tracking. This indicator identifies breakouts of previous swing highs/lows on higher timeframes, then systematically tracks and validates multiple FVGs within each trend direction, generating precise entry signals when price respects the gap structure.
How It Works
Higher Timeframe Trend Detection
The indicator analyzes a higher timeframe (default 15-minute) to determine the overall bias, displaying background colors that show bullish or bearish directionality. This ensures you only trade with institutional trend direction.
Market Structure Shift (MSS/BOS)
When price closes above a previous swing high (in uptrends) or below a previous swing low (in downtrends), a BOS (Break of Structure) is marked with a line and label. This signals that the institutional structure has shifted and a new trend impulse is beginning.
Multi-Level FVG Tracking
Once an MSS occurs:
The indicator begins scanning for Fair Value Gaps (gaps between candles where no trading occurred)
Bullish FVGs: Gaps above the closing price of a bearish candle (low > high[2])
Bearish FVGs: Gaps below the closing price of a bullish candle (high < low[2])
Multiple FVGs are tracked simultaneously (up to 5 configurable) across the same impulse
Intelligent FVG Validation
Each FVG is continuously monitored:
Invalidated: If price closes through the gap (below a bullish FVG or above a bearish FVG), it's automatically deleted
Touched: If price enters the gap zone, it's marked as "touched"
Signal Generated: When a touched FVG shows strong directional confirmation (bullish candle closing above the FVG top, or bearish candle closing below the FVG bottom), a LONG or SHORT signal is triggered
Key Features
HTF Trend Confirmation: Only trades aligned with higher timeframe bias (eliminates counter-trend noise)
Multi-FVG Architecture: Tracks up to 5 gaps per trend impulse simultaneously
Automatic Gap Invalidation: Removes FVGs that break below/above, keeping only valid levels
Smart Signal Generation: Entry signals require both FVG respect + directional confirmation
Color-Coded Structure: Bullish signals in green, bearish in red with instant visual clarity
Background Trend Visualization: Subtle background shading shows HTF bias at all times
Customizable Parameters: Adjust swing period, HTF timeframe, and max FVGs to track
Ideal For
ICT Smart Money traders using FVG + MSS methodologies
Institutional order flow analysts trading market structure
Multi-timeframe traders looking for confluence-based entries
Scalpers to swing traders on 5-minute to 1-hour charts
Anyone seeking high-probability setups with clear invalidation rules
Trading Applications
Scalp FVG reversals: Enter when price respects a touched FVG with confirmation
Trade impulses with structure: Follow MSS with FVG confluence for institutional-grade entries
Identify pullback opportunities: Track multiple FVGs during retracements for re-entry zones
Confirm breakout validity: Only take breaks when aligned with HTF trend + FVG structure
Avoid false breakouts: Invalidated FVGs signal that the move is losing structure
How to Use
Wait for the MSS: Background color shift + BOS line confirms market structure break
Monitor FVG Creation: Boxes appear as gaps form within the new impulse
Watch for Invalidation: Red boxes disappear if price breaks the gap—signal invalid
Wait for Touch + Confirmation: FVG must be touched AND show strong directional candle
Take the Signal: Triangle entry markers appear with audio/visual alerts
Clear Risk Management: Use the invalidated FVG level as your stop loss
Signal Strength Indicators
Strongest Setup: Multiple FVGs created + one respects while others invalidate (shows structure)
Medium Setup: Single FVG touched and confirmed
Weaker Setup: Quick touch with weak confirmation candle (wait for better structure)
Customization Options
HTF Timeframe: Change from 15-min to 5, 30, 60 min or higher for different trading styles
Swing Period: Adjust from 10 bars for faster detection to 20+ for structural shifts
Max FVGs: Track 1-5 simultaneous gaps (lower = cleaner, higher = more opportunities)
Colors: Customize bullish/bearish colors to match your chart theme
Default Settings Optimized For
NASDAQ futures and liquid forex pairs
5-minute to 1-hour timeframe trading
Smart Money / ICT methodology
High-probability impulse + gap trading
Pro Tips
The cleaner your chart (fewer invalidated FVGs), the stronger the structural move
Multiple valid FVGs in one impulse suggest institutional accumulation/distribution
HTF background color changes are early warnings of trend structure shift
Best setups occur when 2-3 FVGs exist and one shows clear confirmation
Description
An advanced institutional trading tool that combines Market Structure Shift (MSS) detection with multi-level Fair Value Gap (FVG) tracking. This indicator identifies breakouts of previous swing highs/lows on higher timeframes, then systematically tracks and validates multiple FVGs within each trend direction, generating precise entry signals when price respects the gap structure.
How It Works
Higher Timeframe Trend Detection
The indicator analyzes a higher timeframe (default 15-minute) to determine the overall bias, displaying background colors that show bullish or bearish directionality. This ensures you only trade with institutional trend direction.
Market Structure Shift (MSS/BOS)
When price closes above a previous swing high (in uptrends) or below a previous swing low (in downtrends), a BOS (Break of Structure) is marked with a line and label. This signals that the institutional structure has shifted and a new trend impulse is beginning.
Multi-Level FVG Tracking
Once an MSS occurs:
The indicator begins scanning for Fair Value Gaps (gaps between candles where no trading occurred)
Bullish FVGs: Gaps above the closing price of a bearish candle (low > high[2])
Bearish FVGs: Gaps below the closing price of a bullish candle (high < low[2])
Multiple FVGs are tracked simultaneously (up to 5 configurable) across the same impulse
Intelligent FVG Validation
Each FVG is continuously monitored:
Invalidated: If price closes through the gap (below a bullish FVG or above a bearish FVG), it's automatically deleted
Touched: If price enters the gap zone, it's marked as "touched"
Signal Generated: When a touched FVG shows strong directional confirmation (bullish candle closing above the FVG top, or bearish candle closing below the FVG bottom), a LONG or SHORT signal is triggered
Key Features
HTF Trend Confirmation: Only trades aligned with higher timeframe bias (eliminates counter-trend noise)
Multi-FVG Architecture: Tracks up to 5 gaps per trend impulse simultaneously
Automatic Gap Invalidation: Removes FVGs that break below/above, keeping only valid levels
Smart Signal Generation: Entry signals require both FVG respect + directional confirmation
Color-Coded Structure: Bullish signals in green, bearish in red with instant visual clarity
Background Trend Visualization: Subtle background shading shows HTF bias at all times
Customizable Parameters: Adjust swing period, HTF timeframe, and max FVGs to track
Ideal For
ICT Smart Money traders using FVG + MSS methodologies
Institutional order flow analysts trading market structure
Multi-timeframe traders looking for confluence-based entries
Scalpers to swing traders on 5-minute to 1-hour charts
Anyone seeking high-probability setups with clear invalidation rules
Trading Applications
Scalp FVG reversals: Enter when price respects a touched FVG with confirmation
Trade impulses with structure: Follow MSS with FVG confluence for institutional-grade entries
Identify pullback opportunities: Track multiple FVGs during retracements for re-entry zones
Confirm breakout validity: Only take breaks when aligned with HTF trend + FVG structure
Avoid false breakouts: Invalidated FVGs signal that the move is losing structure
How to Use
Wait for the MSS: Background color shift + BOS line confirms market structure break
Monitor FVG Creation: Boxes appear as gaps form within the new impulse
Watch for Invalidation: Red boxes disappear if price breaks the gap—signal invalid
Wait for Touch + Confirmation: FVG must be touched AND show strong directional candle
Take the Signal: Triangle entry markers appear with audio/visual alerts
Clear Risk Management: Use the invalidated FVG level as your stop loss
Signal Strength Indicators
Strongest Setup: Multiple FVGs created + one respects while others invalidate (shows structure)
Medium Setup: Single FVG touched and confirmed
Weaker Setup: Quick touch with weak confirmation candle (wait for better structure)
Customization Options
HTF Timeframe: Change from 15-min to 5, 30, 60 min or higher for different trading styles
Swing Period: Adjust from 10 bars for faster detection to 20+ for structural shifts
Max FVGs: Track 1-5 simultaneous gaps (lower = cleaner, higher = more opportunities)
Colors: Customize bullish/bearish colors to match your chart theme
Default Settings Optimized For
NASDAQ futures and liquid forex pairs
5-minute to 1-hour timeframe trading
Smart Money / ICT methodology
High-probability impulse + gap trading
Pro Tips
The cleaner your chart (fewer invalidated FVGs), the stronger the structural move
Multiple valid FVGs in one impulse suggest institutional accumulation/distribution
HTF background color changes are early warnings of trend structure shift
Best setups occur when 2-3 FVGs exist and one shows clear confirmation
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.