Simple MSS Detector + FVG Filter + Alerts (mihaifx888)Simple MSS (Market Structure Shift) + Break Line + FVG Filter
This indicator identifies Market Structure Shifts (MSS) using a clean, pivot-based approach and optionally filters them using Fair Value Gaps (FVGs) for higher-quality signals.
It is designed for traders who want a clear, minimal, and rule-based structure shift tool without overcomplication.
Personally, I use it to set up alerts for MSS after valid liquidity gets broken and/or price enters a FVG. This way I don't waste time on charts or setting up alerts manually.
You can play with the pivot length from 1 to 5, levels. I use it on level 2 and 3.
1 = aggressive
5 = super conservative
⸻
How it works
1. Structure definition
• Uses pivot highs and lows to define swing structure
• Tracks the most recent confirmed swing high and swing low
• Structure shifts are only detected when the trend flips:
• Bearish → Bullish (bullish MSS)
• Bullish → Bearish (bearish MSS)
2. Break confirmation
• Choose how structure is considered broken:
• Close beyond the swing level
• Wick beyond the swing level
3. MSS visualization
• When a valid MSS occurs, the script draws a horizontal line
• The line is drawn from the original swing level to the break candle
• Separate colors for bullish and bearish MSS
• Adjustable line thickness
⸻
Optional Fair Value Gap (FVG) filter
You can require a valid Fair Value Gap to appear before the MSS, adding confluence and filtering weaker structure shifts.
• Detects classic 3-candle FVGs:
• Bullish FVG: current low > high two candles back
• Bearish FVG: current high < low two candles back
• Configurable lookback window (number of bars)
• Optional minimum FVG size filter, based on ATR:
• Helps ignore very small or insignificant imbalances
You can enable or disable the FVG filter at any time.
⸻
Alerts
• Bullish MSS alert (Bear → Bull)
• Bearish MSS alert (Bull → Bear)
• Alerts respect all active filters and settings
⸻
Best use cases
• Intraday and lower-timeframe structure analysis
• Liquidity-based or reversal strategies
• MSS confirmation after sweeps, ranges, or session highs/lows
• Works on any market and timeframe
⸻
Notes
• This indicator does not repaint confirmed signals
• It is a structure-only tool and does not provide trade entries or risk management
• Intended as a context and confirmation indicator, not a standalone system
Pine Script® indicator






















