[ A L P H A X ] Fair Value Gap (FVG) TrackerAlphaX Fair Value Gap (FVG) Tracker — ICT FVG Zones, CE Midline, MTF, Entry Signals & Fill Detection
The most complete Fair Value Gap tool built for ICT and Smart Money Concept traders. AlphaX FVG Tracker automatically detects every bullish and bearish imbalance on your chart, renders clean filled zones with CE midlines, monitors fill status in real time, fires precise entry signals at the 50% level, and tracks every FVG across multiple timeframes simultaneously — all inside a single professional indicator built on Pine Script v6.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔍 What This Indicator Does
Fair Value Gaps are one of the most powerful concepts in ICT and Smart Money trading — they represent price inefficiencies left behind by aggressive institutional moves that the market is statistically likely to revisit and fill. AlphaX FVG Tracker removes all the manual work. It scans every candle for valid three-candle FVG formations, plots each zone instantly, tracks whether it has been partially or fully filled, and signals the exact moment price returns to retest it — on any market, any timeframe, in real time.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚡ Key Features
📦 Automatic FVG Zone Detection
Every bullish and bearish Fair Value Gap is detected the moment it forms using the standard three-candle imbalance structure — candle one high below candle three low for bullish FVGs, candle one low above candle three high for bearish FVGs. Zones are rendered immediately as filled boxes with clean borders, extending forward in time so you never miss a revisit. Optional ATR and minimum size filters eliminate noise and keep only meaningful imbalances on your chart.
📏 CE Midline (50% Equilibrium)
Every FVG zone plots a dashed midline at its exact 50% level — the Consequent Encroachment or CE level used by ICT traders as the primary entry trigger and retest confirmation level. The CE line extends with the box and updates live as price approaches.
🔵🔴 Real-Time Fill Status Tracking
Every active FVG is continuously monitored for price interaction. Partial fills are tracked separately from full fills. When a zone is fully filled, it automatically dims to a lower opacity so your chart stays clean and uncluttered — showing you only what is still active and relevant. The auto-remove option deletes fully filled zones entirely if you prefer a minimal chart.
🎯 ICT / SMC Entry Signals
When price returns to retest an active FVG, an entry signal fires with a clearly labelled marker. Three entry modes are available:
CE Touch — entry triggered when price touches the 50% midline, the primary ICT entry model
50% Retest — entry on any wick into the 50% level
Full Fill Edge — entry at the zone boundary for more aggressive positioning
Optional candle close confirmation filters out wicks and ensures only confirmed bars trigger the signal — reducing false entries in choppy conditions.
🌐 Multi-Timeframe FVG Overlay
Enable HTF mode to overlay Fair Value Gaps from a higher timeframe directly onto your current chart. HTF FVGs are rendered with a distinct colour and thicker border so they are immediately distinguishable from current timeframe zones. Ideal for confluence analysis — entering at a current timeframe FVG that aligns with an HTF FVG significantly increases setup quality.
📋 Professional Stats Dashboard
A compact on-chart dashboard tracks every key metric in real time:
Total FVGs detected — bullish and bearish separately
Active FVGs — currently open and unmitigated
Filled FVGs — fully mitigated zones
Fill Rate % — historical fill percentage for both directions
HTF Mode status and active entry mode
All metrics update live as price moves and new FVGs form.
🔔 4 Built-In Alert Conditions — Webhook Ready
New Bullish FVG — fires when a new bullish imbalance is detected
New Bearish FVG — fires when a new bearish imbalance is detected
New FVG (Any Direction) — fires on either type
Entry Signal — fires when price retests an active FVG and meets entry criteria
All alerts fire on confirmed bar close. Connect directly to Telegram, 3Commas, Alertatron, n8n, or any webhook service for fully automated signal delivery.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙ Settings Reference
General Settings
Max FVGs to Display (default: 30) — maximum number of zones rendered simultaneously
Show Filled FVGs — dimmed zones remain visible after being fully mitigated
Auto-Remove Fully Filled FVGs — delete filled zones entirely for a clean chart
Extend FVG Boxes (default: 50 bars) — how far boxes extend to the right
Show CE Midline — toggle the dashed 50% equilibrium line inside each zone
Show Signals on New FVG — toggle the small FVG marker label when a new zone forms
Bullish / Bearish FVG
Show Bullish / Bearish FVGs — toggle each direction independently
Fill Color — zone background opacity and colour
Border Color — zone outline colour
Filled (Dimmed) Color — colour of the zone after it has been fully mitigated
CE Line Color — colour of the dashed midline
Multi-Timeframe
Enable HTF FVGs — overlay higher timeframe zones on the current chart
Higher Timeframe — select from 5, 15, 30, 60, 120, 240 minutes, Daily, or Weekly
HTF Bullish / Bearish Color — distinct colours for HTF zones
HTF Border Width — thicker border to distinguish HTF zones from current TF
Filter Settings
Min FVG Size (points) — ignore FVGs smaller than this value. Set to 0 to disable
Use ATR Filter — dynamically size the minimum FVG threshold using ATR
ATR Multiplier — controls how aggressively ATR filtering removes small FVGs
ATR Length — lookback period for ATR calculation
Entry Signals
Show FVG Entry Signals — toggle entry markers on zone retests
Entry Mode — CE Touch, 50% Retest, or Full Fill Edge
Require Candle Close Confirmation — only fire on confirmed closed bars
Dashboard
Show Dashboard — toggle the stats table
Position — Top Right, Top Left, Bottom Right, Bottom Left
Text Size — Tiny, Small, or Normal
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🚀 How to Use
Add AlphaX FVG Tracker to any chart — default settings work across all markets and timeframes
Watch for price to leave a zone unmitigated after a strong impulsive move — these are your highest-quality setups
Use the CE midline as your primary entry trigger — a close back above the CE on a bullish FVG or below on a bearish FVG is a classic ICT confirmation
Enable HTF mode and look for confluence between current timeframe and higher timeframe FVGs — these dual-timeframe stacks are the most reliable entry points
Monitor fill rates in the dashboard — if bullish FVGs are filling at a high rate in your market, it indicates strong bullish continuation bias
Enable alerts and connect to your automation stack for hands-free signal delivery
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
👥 Who This Is For
📈 ICT traders — built around the exact Fair Value Gap model taught in ICT concepts including CE retest entries
🧠 Smart Money Concept (SMC) traders — use FVG zones for order flow confluence and institutional footprint analysis
🥇 Gold (XAUUSD) traders — FVGs are especially reliable in XAU due to its liquidity-driven, gap-filling behavior
📉 Forex and Index traders — works on all major pairs, US30, NAS100, SPX500, and more
🌍 Crypto traders — effective on BTC, ETH, and high-volume altcoins across all sessions
🤖 Algo and bot traders — webhook-ready alerts for all FVG events and entry signals
⏱ All timeframes — from M1 intraday scalping to Daily swing setups
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📝 Notes
Works on all asset classes — Gold, Forex, Crypto, Futures, Indices, Stocks
No repainting — all zones and signals are based on confirmed closed bars
FVG zones update in real time as price interacts with them
Pine Script v6 — built for performance, reliability, and forward compatibility
All visual elements are individually toggleable for a clean, distraction-free chart
Recommended timeframes: M5, M15, M30, H1, H4, Daily
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Built for traders who trade with precision, not guesswork. Indicator

London Open First 5minsThis indicator shows the first 5mins candle status of the London OPEN at 3AM (New York Time).
1. GREEN Highlight: when the first 5mins closed bullish
2. RED Highlight: when the first 5mins closed bearish
3. GREEN LINE: the bullish 5mins closing price, extend to NY 08:30AM
4. RED LINE: the bearish 5mins closing price, extend to NY 08:30AM
5. GREEN +OB LINE (Order Block): when the first 5mins closed bearish, the immediate following 5mins closed bullish above the bearish wick of the first 5mins candle (engulfing)
6. RED -OB LINE (Order Block): when the first 5mins closed bullish, the immediate following 5mins closed bearish below the bullish wick of the first 5mins candle (engulfing)
Please NOTE: this indicator only shows the first wave of London / European Markets OPEN momentum, it cannot be used for pure ENTRY / EXIT signals along.
~~~~
I personally use this indicator for the following purposes:
1. By observations, the first 5mins candle shows signs of strength / weakness at the London session;
2. Within that 5mins candle, micro structures may appear, such as 1m / 2m / 3m structures with FVGs (Fair Value Gap) and / or OBs (Order Block);
3. The immediately following 5mins candle either respect or reject the first 5mins, can provide more insights of the market maker's intentions;
4. This indicator cannot use along, it must follow the HTF (Higher Time Frame) structure, such as 15mins, 1H, 4H. Indicator

Statistical FVG | ProjectSyndicateStatistical FVG automatically identifies Fair Value Gaps, filters them by session Asian, London, NY, and presents a live statistical dashboard quantifying the historical performance of every FVG type. It transforms the subjective FVG pattern into a purely objective, data-driven trading tool.
🧠 Live Statistical Dashboard — The core of the indicator. This is not a static score. The dashboard displays the live, data-driven statistics for both Bullish and Bearish FVGs, including the Win Rate, Probability of Touch, Average Win/Loss Bars, R:R Ratio, Sample Size, and the critical Expected Value (EV). This gives you an instant, quantifiable edge.
🎯 Session-Specific Edge — The engine's most powerful feature. It doesn't just find FVGs; it categorizes them by the session in which they formed Asian, London, or New York. The dashboard allows you to see if, for example, Bearish FVGs from the New York session have a historically higher win rate and EV than those from the Asian session, allowing you to focus only on the highest-probability setups.
🎨 Normalized & Extended Zones — Eliminates visual noise from inconsistent FVG sizes. This feature forces every FVG zone to a uniform, clean height. It also extends the zones far into the future until they are mitigated, ensuring you never miss a reaction to a key level.
📊 Historical Zone Plotting — Mitigated doesn't mean forgotten. A toggleable option allows you to see all past, mitigated FVGs as faded, non-intrusive zones on your chart. This provides a complete historical footprint of where the market has reacted, allowing for deeper analysis of legacy price structures.
✅ Full-History Accumulator — The statistical engine's credibility comes from its depth. On every bar, it simulates the outcome of every valid FVG across the chart's full history, constantly feeding the win/loss accumulator. The stats you see are robust and based on a large sample size — not just the last few signals.
🔧 Fully Customizable — Control every aspect of the engine, including the TP/SL ATR ratios used for the statistical calculations and the colors/visibility of Bullish, Bearish, and Historical FVG zones.
🔬 Why this algo is unique: Standard FVG indicators are subjective — they just draw boxes on a 3-candle imbalance with no statistical proof of edge. The Manus FVG Stats Engine transforms this common pattern into an objective, quantitative trading instrument. It doesn't just show you an FVG; it shows you the historical performance and statistical probability of that FVG type working out, broken down by session, based on thousands of back-tested examples on the exact chart you are viewing.
🌐 Apply to Gold (XAUUSD), Indices (US30, NAS100), Forex Majors, and Crypto on M5, M15, or H1 timeframes. The engine is designed for intraday assets and timeframes that exhibit clear FVG structures and respect liquidity dynamics.
🗂️ How to use this? The most critical metric is the Expected Value (EV) on the dashboard. A positive EV for a specific FVG type e.g., Bullish NY/London indicates a statistical edge over the long term. Consider only taking trades from FVG types with a positive EV and a Win Rate that aligns with your risk tolerance. For higher-probability setups, align your trades with the prevailing higher-timeframe trend.
⚙️ IMPORTANT NOTICE: This indicator is a professional-grade tool designed to identify a statistical edge. It should NOT be used as a standalone signal for entering trades. Always use it in conjunction with your own trading strategy, price action analysis, and other technical indicators to confirm trade setups and manage risk. Indicator

MTF Fair Value GapsMulti-Timeframe Fair Value Gaps (MTF-FVG) with Smart Mitigation
Overview
The Multi-Timeframe Fair Value Gaps (MTF-FVG) indicator is a high-performance price action tool designed for ICT and SMC (Smart Money Concepts) traders. Unlike standard FVG indicators that limit you to your current view, this script allows you to overlay gaps from up to five additional timeframes simultaneously, providing a "birds-eye view" of institutional liquidity without ever switching charts.
Key Features
True MTF Integration: Visualize 5m, 15m, 1h, 4h, and Daily FVGs (or your own custom selection) directly on a 1-minute chart.
Institutional Alignment: Each FVG is drawn with precision, starting exactly at the wick of the first candle in the 3-bar sequence for professional-grade alignment.
Smart Mitigation Engine: To prevent "chart clutter," the indicator automatically detects when price has traded through a zone. Once a gap is mitigated, the script cleans up the box in real-time.
Visual Midpoints: Every gap includes an optional dotted midpoint line (Consequent Encroachment), a key level for entries and institutional reactions.
Fully Customizable Aesthetic: Includes a refined color palette by default (Grey, Orange, Yellow, Blue, Purple) with 10% shading to ensure your price action remains the focal point.
How to Use
Confluence Trading: Look for "Stacked FVGs"—areas where a Higher Timeframe (HTF) gap overlaps with a Current Timeframe (CTF) gap. These are high-probability zones for reversals or continuations.
Liquidity Re-entry: Use the dotted midpoint line to identify the 50% level (CE) of the gap, where institutions often seek to fill orders.
Trend Confirmation: Use HTF gaps to determine the higher-level bias. If a Daily FVG is sitting above price, look for bullish setups on lower timeframes to fill that draw on liquidity.
Settings
Threshold %: Filter out tiny gaps by setting a minimum percentage size relative to price.
Box Extension: Control how far to the right the FVG zones project.
Timeframe Toggles: Individually enable or disable the 5 HTF slots.
Mitigation Toggle: Choose between keeping historical gaps for reference or auto-deleting them for a cleaner look.
Developer Note
Built on Pine Script® v6 with dynamic_requests enabled, this indicator is optimized for speed and accuracy. It respects the core logic of the original LuxAlgo FVG detection while expanding it into a powerful multi-timeframe suite.
Disclaimer: Trading involves significant risk. This indicator is a tool to assist in technical analysis and does not constitute financial advice. Indicator

Volumetric Inverse Fair Value Gap (VIFVG) [UAlgo]Volumetric Inverse Fair Value Gap is an imbalance analysis tool that tracks the full lifecycle of a Fair Value Gap and then focuses on what happens after that gap fails. Instead of stopping at the initial gap detection, the script stores qualifying bullish and bearish FVGs, waits for price to invalidate them from the opposite side, and then converts those failed imbalances into active Inverse Fair Value Gaps.
The main idea is rooted in role reversal. A bullish Fair Value Gap may initially represent an area of inefficiency below price, but if price later trades through that gap in the opposite direction, the same zone can flip into a bearish inverse area. The same logic applies in reverse for bearish gaps that later fail to the upside. This script automates that transition and keeps the resulting IFVG visible on the chart as long as it remains active.
What makes this version more distinctive is the volumetric overlay inside the inverse zone. Once an IFVG is created, the script attaches three internal metrics to it. The first estimates bullish participation, the second estimates bearish participation, and the third measures relative volume strength using percentile rank. These values are then displayed inside the box as horizontal progress bars, turning the IFVG into both a structural level and a compact participation summary.
The indicator also supports a ghost box that preserves the original FVG location from the moment it was created until the moment it became inverse. This gives the user a clearer narrative of how the imbalance formed and where the role reversal occurred. Combined with the active box, the result is a visually informative workflow for traders who want to study failed imbalances, structure flips, and how strong the inversion candle was when the role change happened.
In practical use, the script can help identify zones where a former inefficiency has turned into a reaction area, while also showing whether the inversion event carried more bullish pressure, more bearish pressure, or unusually strong participation relative to recent volume history.
🔹 Features
🔸 Fair Value Gap Detection With ATR Filtering
The script first detects classic three candle FVG structures, then filters them using a minimum gap size expressed in ATR units. This helps reduce noise and removes smaller gaps that may be less meaningful.
🔸 Strict and Non Strict Detection Modes
Strict mode requires actual wick separation between the first and third candle. Non strict mode allows close based confirmation instead. This gives the user control over how precise the gap definition should be.
🔸 Pending FVG Lifecycle Tracking
Detected FVGs are not immediately turned into inverse zones. They are first stored as pending gaps and monitored until price later crosses them in the opposite direction.
🔸 Automatic FVG to IFVG Conversion
When price invalidates a pending gap from the opposite side, the script creates a new Inverse Fair Value Gap object and begins tracking it as an active zone.
🔸 Ghost Box Support
The original FVG can be preserved visually as a dashed ghost box from the creation time of the imbalance to the inversion time. This makes it easier to see the original gap and the later role reversal event together.
🔸 Volumetric Breakdown Inside the IFVG
Each active inverse gap includes three stacked internal bars:
estimated bullish participation,
estimated bearish participation,
and relative strength.
This gives the zone more context than a normal box alone.
🔸 Participation Estimation From Candle Anatomy
Bullish and bearish participation are estimated from the inversion candle’s structure and volume. This creates a practical volume split model that helps describe how the inversion occurred.
🔸 Strength Metric From Volume Percentile Rank
The script measures how strong the inversion candle’s volume is relative to the last one hundred bars. This is displayed as a separate strength bar inside the IFVG.
🔸 Live Box Expansion
As long as an IFVG remains active, its container extends forward in time. The internal volumetric bars and text labels are updated continuously so the zone remains clear and readable.
🔸 Automatic Invalidation
A bullish IFVG is removed if price closes below its bottom. A bearish IFVG is removed if price closes above its top. This keeps the display focused on still valid inverse zones.
🔸 Controlled History Size
The script limits how many active IFVGs remain on the chart. Older ones are removed once the display exceeds the selected history count.
🔹 Calculations
1) Defining the Pending Gap and Active IFVG Objects
type PendingFVG
float top
float btm
bool is_bull_gap
bool processed
int created_time
type IFVG
int start_time
int origin_time
float top
float btm
bool is_bull_ifvg
float pct_bull
float pct_bear
float pct_strength
box container
box ghost_box
box bg_bull
box bar_bull
box bg_bear
box bar_bear
box bg_str
box bar_str
label lbl_bull
label lbl_bear
label lbl_str
bool active
This is the structural foundation of the script.
A PendingFVG stores an imbalance that has been detected but has not yet inverted. It contains the gap boundaries, whether the original gap was bullish or bearish, whether it has already been processed into an inverse gap, and the time when it was created.
An IFVG stores the full active inverse gap state. In addition to the price boundaries and direction, it also stores the three internal metrics, the container box, the optional ghost box, the internal background and progress bars, the labels, and the active state.
So the script is not just drawing boxes. It is managing two linked object lifecycles:
pending FVGs,
and active inverse FVGs.
2) ATR Filter for Gap Significance
float atr_val = ta.atr(14)
The ATR value is used as the script’s minimum significance filter.
Instead of accepting every visible gap, the script compares gap size against a fraction of ATR. This is useful because a fixed price threshold would behave very differently across markets and timeframes, while ATR gives a volatility aware reference.
So ATR acts as the noise filter that decides whether a newly found gap deserves to be tracked.
3) Estimating Bullish and Bearish Participation
calc_metrics(float o, float h, float l, float c, float v) =>
float rng = h - l
float buy_v = 0.0
if rng == 0
buy_v := v * 0.5
else
if c >= o
buy_v := v * ((math.abs(c - o) + (math.min(o, c) - l)) / rng)
else
buy_v := v * ((h - math.max(o, c)) / rng)
float sell_v = v - buy_v
float total = buy_v + sell_v
float p_bull = total > 0 ? buy_v / total : 0
float p_bear = total > 0 ? sell_v / total : 0
float p_str = ta.percentrank(v, 100) / 100.0
This function is one of the most important parts of the whole script.
Its goal is to turn one candle into three interpretable metrics:
bullish share,
bearish share,
and strength.
First, the script measures the candle range. If the candle has zero range, volume is split evenly.
If the candle has a real range, the script estimates buying pressure differently depending on candle direction.
For bullish candles, buy volume is influenced by the candle body plus the lower section of the candle.
For bearish candles, buy volume is approximated from the remaining upper section.
The result is not true exchange level aggressor volume, but it is a practical candle anatomy based estimate of how much of the inversion bar behaved more like buying versus selling.
Then the script converts those raw buy and sell estimates into proportions:
p_bull
and
p_bear
Finally, it calculates p_str using the percentile rank of current volume over the last one hundred bars. That means the strength value is not just raw volume. It describes how relatively strong the inversion candle was compared with recent history.
4) Reading the Current Candle Metrics
= calc_metrics(open, high, low, close, volume)
This line applies the volumetric function to the current bar.
These three values are later attached to a new IFVG at the moment of inversion. So each active inverse gap inherits the participation and strength profile of the candle that caused the role reversal.
That is important conceptually. The internal bars inside the IFVG are not random decorations. They represent the inversion event itself.
5) Detecting Bullish and Bearish FVGs
bool bull_cond = strict_mode ? (low > high ) : (close > high )
bool bear_cond = strict_mode ? (high < low ) : (close < low )
This block defines the actual Fair Value Gap logic.
In strict mode:
a bullish gap exists only when the current low is above the high from two bars ago,
and a bearish gap exists only when the current high is below the low from two bars ago.
That means actual wick separation is required.
In non strict mode:
the script relaxes this and allows close based confirmation instead.
So the user can choose whether the script should only accept clean wick gaps or allow a softer close based definition.
6) Measuring the Gap Size
float gap_size = 0.0
if bull_cond and close > open
gap_size := low - high
if bear_cond and close < open
gap_size := low - high
bool is_significant = gap_size >= (atr_val * fvg_threshold_atr)
Once a candidate FVG is found, the script measures how large the gap actually is.
For bullish gaps, the size is the distance between the current low and the high from two bars ago.
For bearish gaps, the size is the distance between the low from two bars ago and the current high.
The script also adds a candle direction filter on the middle bar:
bullish gaps require the middle candle to be bullish,
and bearish gaps require the middle candle to be bearish.
Finally, the measured gap must be at least as large as:
ATR × threshold
This removes smaller gaps that may simply be noise.
7) Storing a Pending FVG
if is_significant
PendingFVG p = PendingFVG.new()
p.created_time := time
p.processed := false
if bull_cond
p.is_bull_gap := true
p.top := low
p.btm := high
else
p.is_bull_gap := false
p.top := low
p.btm := high
array.push(pending_fvgs, p)
If the gap is significant, the script stores it as a pending FVG.
The gap is not drawn yet as an inverse zone. Instead, it is placed into the pending list with:
its direction,
its boundaries,
its creation time,
and a flag showing it has not yet been processed.
This is important because an FVG only becomes an IFVG after it fails. The pending list is the waiting room for that future role reversal.
8) Detecting the Inversion Event
if array.size(pending_fvgs) > 0
for i = array.size(pending_fvgs) - 1 to 0
PendingFVG p = array.get(pending_fvgs, i)
if not p.processed
bool inverted = false
bool to_bull = false
if not p.is_bull_gap and close > p.top
inverted := true
to_bull := true
if p.is_bull_gap and close < p.btm
inverted := true
to_bull := false
This is the core IFVG transition logic.
A pending bearish FVG becomes a bullish IFVG if price closes above its top.
A pending bullish FVG becomes a bearish IFVG if price closes below its bottom.
That is the actual role reversal event. Price has invalidated the original imbalance from the opposite side, so the gap flips into an inverse form.
The to_bull flag determines the direction of the new inverse zone.
9) Creating the IFVG Object
if inverted
IFVG obj = IFVG.new()
obj.start_time := time
obj.origin_time := p.created_time
obj.top := p.top
obj.btm := p.btm
obj.is_bull_ifvg := to_bull
obj.pct_bull := curr_p_bull
obj.pct_bear := curr_p_bear
obj.pct_strength := curr_p_str
obj.active := true
obj.create_drawings()
array.push(active_ifvgs, obj)
p.processed := true
Once inversion is confirmed, the script creates the active IFVG.
The new object inherits:
the original FVG boundaries,
the original creation time,
the inversion start time,
and the new inverse direction.
It also stores:
the bullish participation percentage,
the bearish participation percentage,
and the strength percentage from the inversion candle.
So the IFVG is a structural object with a built in event profile. It tells the user not only where the failed gap is located, but also what the inversion bar looked like in participation terms.
10) Creating the Ghost Box and Main Container
if show_ghost
this.ghost_box := box.new(
left=this.origin_time,
top=this.top,
right=this.start_time,
bottom=this.btm,
border_color=color.new(c_border, 20),
border_width=1,
border_style=line.style_dashed,
bgcolor=c_ghost,
xloc=xloc.bar_time
)
this.container := box.new(
left=this.start_time,
top=this.top,
right=time,
bottom=this.btm,
border_color=c_border,
border_width=1,
bgcolor=color(na),
xloc=xloc.bar_time
)
This is the first part of the IFVG drawing engine.
If ghost mode is enabled, the script draws a dashed box from the original FVG creation time to the inversion time. This visually represents the original gap before it failed.
Then it creates the main IFVG container box starting from the inversion time and extending to the current bar.
So the chart can show both:
where the original gap existed,
and where the inverse zone now lives.
11) Building the Internal Volumetric Bar Areas
this.bg_bull := box.new(this.start_time, this.top, time, this.top, border_width=0, bgcolor=c_bg_dark, xloc=xloc.bar_time)
this.bar_bull := box.new(this.start_time, this.top, this.start_time, this.top, border_width=0, bgcolor=c_bull_bar, xloc=xloc.bar_time)
this.bg_bear := box.new(this.start_time, this.top, time, this.top, border_width=0, bgcolor=c_bg_dark, xloc=xloc.bar_time)
this.bar_bear := box.new(this.start_time, this.top, this.start_time, this.top, border_width=0, bgcolor=c_bear_bar, xloc=xloc.bar_time)
this.bg_str := box.new(this.start_time, this.top, time, this.top, border_width=0, bgcolor=c_bg_dark, xloc=xloc.bar_time)
this.bar_str := box.new(this.start_time, this.top, this.start_time, this.top, border_width=0, bgcolor=c_str_bar, xloc=xloc.bar_time)
Inside every IFVG, the script creates three horizontal rows.
Each row has:
a dark background box,
and a colored progress bar box.
The three rows represent:
bullish participation,
bearish participation,
and strength.
Initially these boxes are created with minimal size. Their real geometry is set later during updates.
So the IFVG is designed as a mini information panel embedded directly inside the zone.
12) Slicing the IFVG Into Three Metric Rows
float total_h = this.top - this.btm
float h_slice = total_h / 3
float y1 = this.top
float y2 = this.top - h_slice
float y3 = this.top - 2 * h_slice
float y4 = this.btm
This block divides the IFVG vertically into three equal sections.
The full height of the box is measured, then split into thirds:
the first slice for bullish participation,
the second slice for bearish participation,
the third slice for strength.
This makes the internal visualization clean and consistent regardless of zone height.
13) Converting Percentages Into Horizontal Width
int now = time
int dur = now - this.start_time
if dur <= 0
dur := timeframe.in_seconds() * 1000
int w_bull = math.round(dur * this.pct_bull)
int w_bear = math.round(dur * this.pct_bear)
int w_str = math.round(dur * this.pct_strength)
This is how the script turns percentages into visible progress bars.
The available horizontal width is the elapsed time from the IFVG start to the current bar. That duration becomes the maximum usable width.
Then each stored metric is multiplied by that duration:
bullish percentage controls the bullish bar width,
bearish percentage controls the bearish bar width,
strength percentage controls the strength bar width.
So the internal bars behave like proportion meters stretched across the live duration of the zone.
14) Updating the Bull, Bear, and Strength Bars
this.bg_bull.set_left(this.start_time)
this.bg_bull.set_right(now)
this.bg_bull.set_top(y1)
this.bg_bull.set_bottom(y2)
this.bar_bull.set_left(this.start_time)
this.bar_bull.set_right(this.start_time + w_bull)
this.bar_bull.set_top(y1)
this.bar_bull.set_bottom(y2)
this.bg_bear.set_left(this.start_time)
this.bg_bear.set_right(now)
this.bg_bear.set_top(y2)
this.bg_bear.set_bottom(y3)
this.bar_bear.set_left(this.start_time)
this.bar_bear.set_right(this.start_time + w_bear)
this.bar_bear.set_top(y2)
this.bar_bear.set_bottom(y3)
this.bg_str.set_left(this.start_time)
this.bg_str.set_right(now)
this.bg_str.set_top(y3)
this.bg_str.set_bottom(y4)
this.bar_str.set_left(this.start_time)
this.bar_str.set_right(this.start_time + w_str)
this.bar_str.set_top(y3)
this.bar_str.set_bottom(y4)
These blocks physically place the three metric layers inside the IFVG.
Each background row spans the full current width of the active zone.
Each colored bar spans only the proportional amount determined by the stored metric.
So if bullish participation is high, the bullish bar stretches farther across its row. If strength is low, the strength bar remains shorter.
This gives the zone an at a glance internal profile.
15) Updating the Text Labels
this.lbl_bull.set_xy(center_x, mid_bull)
this.lbl_bull.set_text(str.format("Bull: {0}%", math.round(this.pct_bull * 100)))
this.lbl_bear.set_xy(center_x, mid_bear)
this.lbl_bear.set_text(str.format("Bear: {0}%", math.round(this.pct_bear * 100)))
this.lbl_str.set_xy(center_x, mid_str)
this.lbl_str.set_text(str.format("Str: {0}%", math.round(this.pct_strength * 100)))
The script also prints the numerical values inside the three rows.
Each label is placed at the center of its row and updated with the rounded percentage value.
So the user sees both:
the visual bar length,
and the exact stored percentage.
This makes the IFVG readable even when box width is large or when color alone is not enough.
16) IFVG Invalidation Logic
bool broken = false
if this.is_bull_ifvg and close < this.btm
broken := true
if not this.is_bull_ifvg and close > this.top
broken := true
if broken
this.active := false
this.remove()
An active IFVG only remains valid while price stays on the correct side of its structure.
For bullish IFVG:
if close falls below the bottom, the zone is broken.
For bearish IFVG:
if close rises above the top, the zone is broken.
When that happens, the IFVG is marked inactive and all associated objects are deleted.
So the indicator is not just drawing inverse gaps indefinitely. It actively monitors whether they continue to behave as valid reaction zones.
17) Display Limit Management
while array.size(active_ifvgs) > show_last_n
IFVG d = array.shift(active_ifvgs)
d.remove()
This final block controls how many IFVGs remain visible.
If the number of active inverse gaps exceeds the selected display limit, the oldest one is removed from the front of the array and all of its drawings are deleted.
This keeps the chart focused on the most recent inverse gaps and prevents excessive visual clutter. Indicator

ICT Concepts [UAlgo]ICT Concepts is a broad market structure toolkit that combines several core ICT style elements inside a single script. Instead of focusing on only one concept, the indicator brings together order blocks, market structure shifts, SMT divergence, fair value gaps, balanced price ranges, consequent encroachment, liquidity sweeps, Fibonacci levels, and killzones in one integrated overlay.
The script is designed for traders who want a consolidated structure map rather than a collection of separate indicators. It tracks swing highs and lows, labels structural breaks as BOS or MSS, detects order blocks from a strict candle pattern, identifies imbalances through fair value gap logic, monitors liquidity sweeps around recent pivot levels, and draws structure anchored Fibonacci levels from the latest confirmed break. It can also compare the active chart against a second symbol for SMT divergence and even render a small comparison panel directly on the chart.
One of the strongest qualities of this script is that each module is state aware. Order blocks extend until mitigation. Fair value gaps extend until price trades through them. Structure anchors update after new breaks. Killzones persist historically for a defined number of sessions. SMT events are stored, labeled, and optionally projected inside a mini comparison panel. This makes the script much more than a simple set of static drawings. It behaves like a live structural framework that evolves with price.
From a workflow point of view, the indicator is especially useful for traders who want to read context in layers. Structure tells whether price is breaking with trend or shifting against it. Order blocks and imbalances show where inefficiency or sponsorship may remain. Liquidity sweeps show where recent resting liquidity has likely been taken. Fibonacci levels frame premium, discount, equilibrium, and OTE areas relative to the latest structural move. Killzones add time based session context. Together, these components create a broad market map for discretionary analysis.
🔹 Features
🔸 Single Candle Order Block Detection
The script detects bullish and bearish order blocks using a strict three candle displacement pattern. When a valid setup appears, the order block is stored, extended forward, and removed only after mitigation. Optional mean threshold lines can also be shown inside each block.
🔸 Multi Timeframe Order Blocks
Order block detection can run on a selected timeframe through request.security . This allows higher timeframe order blocks to be projected onto the current execution chart.
🔸 Market Structure Mapping
The indicator tracks pivot highs and lows and labels confirmed structural breaks as BOS or MSS. A continuation break is labeled BOS, while a directional reversal break is labeled MSS. This gives the chart a clear structure narrative.
🔸 SMT Divergence Detection
The script can compare the active chart against a second symbol and detect SMT divergence using pivot highs and lows from both instruments. Divergences are labeled directly on the main chart and can also be reflected inside a mini comparison panel.
🔸 Fair Value Gaps
Bullish and bearish fair value gaps are detected through a classic three candle gap condition. These imbalances are stored, extended, and removed once mitigated.
🔸 Balanced Price Range Support
When a new fair value gap overlaps with an opposite side historical fair value gap, the overlapping section becomes a balanced price range. This gives the script the ability to detect conflict zones formed by opposing inefficiencies.
🔸 Consequent Encroachment Mode
The imbalance module can also be displayed in consequent encroachment mode, where the midpoint of the gap is shown along with the premium or discount half of the imbalance.
🔸 Liquidity Sweep Detection
The indicator monitors recent pivot highs and lows and marks when price trades beyond one of those levels but closes back through it. This makes it easy to spot local buy side and sell side sweeps.
🔸 Structure Anchored Fibonacci Levels
After a confirmed structural break, the script anchors Fibonacci levels between the break extreme and the opposing structural point. Equilibrium, OTE, and optional extra levels are then projected forward.
🔸 Killzone Rendering
The script can mark Asian, London, New York AM, and New York PM session windows using session boxes and optional session range lines. Historical session boxes are kept for a user defined number of prior occurrences.
🔸 Active Object Management
Each subsystem uses its own storage and cleanup logic. Order blocks, imbalances, SMT markers, liquidity sweep boxes, Fibonacci objects, and killzones are all managed so the chart remains usable over time.
🔸 Alerts
Alert conditions are included for bullish and bearish order block detection.
🔹 Calculations
1) Order Block Pattern Logic
detectLogic() =>
bool isBull = open > close and close > open and close > open and low < low and close > high
bool isBear = open < close and close < open and close < open and high > high and close < low
[isBull, high , low , time , isBear, high , low , time ]
This is the core order block detector.
A bullish order block requires:
a bearish candle at 2 ,
a bullish candle at 1 ,
a bullish current candle,
a sweep below the low of candle 2 by candle 1 ,
and a close above the high of candle 1 .
A bearish order block uses the exact inverse.
The returned zone bounds come from candle 1 , which becomes the order block candle. That is why the function returns high , low , and time .
So the script is not marking every displacement candle. It is looking for a very specific three candle formation.
2) Multi Timeframe Order Block Projection
= request.security(syminfo.tickerid, i_tf, detectLogic())
This line runs the order block detection logic on the selected timeframe.
If the user chooses a higher timeframe, the resulting order block values are projected onto the current chart. This is extremely useful for mapping higher timeframe sponsorship zones onto a lower timeframe execution environment.
So the detection can stay structurally higher while the display remains on the user’s active chart.
3) Preventing Overlapping Order Blocks
method hasOverlap(array OBs, float top, float bottom) =>
bool overlap = false
if OBs.size() > 0
for i = 0 to OBs.size() - 1
OB item = OBs.get(i)
if (top < item.top and top > item.bottom) or (bottom > item.bottom and bottom < item.top)
overlap := true
break
overlap
Before a new order block is added, the script checks whether it overlaps an existing stored block of the same side.
If the proposed top or bottom falls inside an existing block, the new one is ignored. This reduces clutter and helps avoid stacking multiple highly similar zones in the same area.
So the order block engine is selective not only in detection, but also in object creation.
4) Order Block Mitigation and Active Limit Handling
method isMitigated(OB this, float currentClose) => this.isBull ? (currentClose < this.bottom) : (currentClose > this.top)
if drawCount < OB_ACTIVE_LIMIT
if na(item.id)
item.draw(i_bullColor, "Bull OB", i_showMidLine)
item.extend()
drawCount += 1
else
item.remove()
An order block remains valid until price closes beyond its invalidation boundary.
For bullish order blocks, mitigation happens when close moves below the block bottom.
For bearish order blocks, mitigation happens when close moves above the block top.
The script also limits how many active blocks are actually drawn. Older stored blocks may remain in memory, but only the most recent valid ones stay visible. This keeps the chart clean while preserving logic continuity.
5) Market Structure Pivot Tracking
float ph = ta.pivothigh(i_structLen, i_structLen)
float pl = ta.pivotlow(i_structLen, i_structLen)
if not na(ph)
prevHigh := lastHigh
prevHighIndex := lastHighIndex
lastHigh := ph
lastHighIndex := bar_index
if not na(pl)
prevLow := lastLow
prevLowIndex := lastLowIndex
lastLow := pl
lastLowIndex := bar_index
This is the base structure engine.
The script identifies confirmed pivot highs and lows using the selected pivot length. When a new pivot is confirmed, the prior stored high or low becomes prevHigh or prevLow , and the newest one becomes lastHigh or lastLow .
This means the indicator always keeps a rolling memory of the latest structural extremes, which later become the reference levels for BOS, MSS, liquidity sweeps, and Fibonacci anchoring.
6) BOS and MSS Logic
bool brokenHigh = ta.crossover(close, lastHigh)
bool brokenLow = ta.crossunder(close, lastLow)
if brokenHigh and not na(lastHigh) and not lastHighBroken
if not trendInitialized or trendIsBullish
drawStructure(lastHighIndex, lastHigh, bar_index, lastHigh, "BOS", i_structBull, "solid")
else
drawStructure(lastHighIndex, lastHigh, bar_index, lastHigh, "MSS", i_structBull, "dashed")
if brokenLow and not na(lastLow) and not lastLowBroken
if not trendInitialized or not trendIsBullish
drawStructure(lastLowIndex, lastLow, bar_index, lastLow, "BOS", i_structBear, "solid")
else
drawStructure(lastLowIndex, lastLow, bar_index, lastLow, "MSS", i_structBear, "dashed")
This is how the script classifies structure.
If close breaks above the last confirmed high, price has broken bullish structure.
If close breaks below the last confirmed low, price has broken bearish structure.
The label depends on prior trend state.
If the break happens in the same directional regime, it is labeled BOS.
If the break happens against the prior regime, it is labeled MSS.
So BOS means continuation of prevailing structure, while MSS means a shift in directional character.
7) SMT Divergence Detection
float smtPhA = i_smtOn ? ta.pivothigh(high, i_smtLen, i_smtLen) : na
float smtPlA = i_smtOn ? ta.pivotlow(low, i_smtLen, i_smtLen) : na
float smtPhB = i_smtOn ? request.security(i_smtSymbol, timeframe.period, ta.pivothigh(high, i_smtLen, i_smtLen)) : na
float smtPlB = i_smtOn ? request.security(i_smtSymbol, timeframe.period, ta.pivotlow(low, i_smtLen, i_smtLen)) : na
This block builds pivot data for both the main symbol and the comparison symbol.
The idea of SMT is relative disagreement. If one market makes a stronger high while the other fails to confirm it, or one market makes a lower low while the other refuses to follow, divergence may be present.
The script therefore tracks pivot highs and lows separately for both instruments.
8) Bearish and Bullish SMT Conditions
bool bearishSmt = not na(smtAHighPrev) and not na(smtBHighPrev) and (smtAHighLast > smtAHighPrev) and (smtBHighLast <= smtBHighPrev)
bool bullishSmt = not na(smtALowPrev) and not na(smtBLowPrev) and (smtALowLast < smtALowPrev) and (smtBLowLast >= smtBLowPrev)
These are the actual divergence tests.
Bearish SMT occurs when the active chart makes a higher high while the comparison symbol fails to do so.
Bullish SMT occurs when the active chart makes a lower low while the comparison symbol fails to confirm that weakness.
So the script is looking for asymmetry between related instruments, which is one of the classic uses of SMT analysis.
9) Mini Panel Rendering for SMT
= request.security(i_smtSymbol, timeframe.period, )
drawMiniCandle(startX + (lookback - 1 - i), o, h, l, c, smtMin, smtRange, baseY, targetHeight, i_smtBull, i_smtBear, isBear, isBull)
The mini panel is built by requesting OHLC data for the comparison symbol, then compressing it into a custom candle panel drawn on the right side of the chart.
Each mini candle is scaled into panel coordinates using the comparison symbol’s own high and low range. SMT event bars are then marked inside that mini chart.
So the panel is not decorative only. It provides a quick structural view of the comparison symbol directly beside the main chart.
10) Fair Value Gap Detection
bool fvgBullDetected = low > high
bool fvgBearDetected = high < low
These are the fair value gap rules.
A bullish fair value gap exists when the current low is above the high from two bars ago.
A bearish fair value gap exists when the current high is below the low from two bars ago.
This is the classic three candle inefficiency model. The gap zone is then stored as an FVG object and extended forward until mitigation.
11) Balanced Price Range Logic
bool hasOverlap = fTop > existing.bottom and fBot < existing.top
if hasOverlap
float bprTop = math.min(fTop, existing.top)
float bprBot = math.max(fBot, existing.bottom)
When a newly detected fair value gap overlaps an opposite side historical fair value gap, the overlapping area becomes a balanced price range.
This is important because BPR is not detected as an isolated standalone pattern. It is formed from the intersection of opposing inefficiencies. The script extracts only the common overlapping region and stores it as a new BPR object.
So BPR here is derived from actual imbalance conflict.
12) Consequent Encroachment Logic
float ceLevel = (this.top + this.bottom) / 2
float boxTop = this.isBull ? ceLevel : this.top
float boxBot = this.isBull ? this.bottom : ceLevel
Consequent encroachment is the midpoint of the fair value gap.
The script calculates the midpoint and, when CE mode is enabled, draws both a dashed midpoint line and a half gap box. For bullish gaps it emphasizes the lower half up to midpoint. For bearish gaps it emphasizes the upper half down to midpoint.
So CE mode gives the user a more precise internal level inside the wider imbalance.
13) Fair Value Gap Mitigation
method isMitigated(FVG this, float currentHigh, float currentLow) => this.isBull ? (currentLow < this.bottom) : (currentHigh > this.top)
A bullish fair value gap is mitigated when price trades below its bottom.
A bearish fair value gap is mitigated when price trades above its top.
Once mitigation happens, the object is removed. This keeps the imbalance display focused on still relevant inefficiencies.
14) Liquidity Sweep Detection
float liqPh = ta.pivothigh(LIQ_PIVOT_LEN, 1)
float liqPl = ta.pivotlow(LIQ_PIVOT_LEN, 1)
bool sweepBull = i_showLiq and not na(liqLastLow) and not liqLastLowSwept and low < liqLastLow and close > liqLastLow
bool sweepBear = i_showLiq and not na(liqLastHigh) and not liqLastHighSwept and high > liqLastHigh and close < liqLastHigh
This module watches recent pivot highs and lows for sweep behavior.
A bullish liquidity sweep occurs when price trades below the most recent sell side liquidity level but closes back above it.
A bearish liquidity sweep occurs when price trades above the most recent buy side liquidity level but closes back below it.
This is a clean wick through and reclaim style sweep model.
15) Liquidity Sweep Box Construction
if sweepBull
line bullSweepLine = line.new(liqLastLowIndex, liqLastLow, bar_index, liqLastLow, color = i_liqSellsideCol, style = line.style_solid)
box bullSweepBox = liqNewSweepBox(liqLastLow, low, i_liqSellsideCol)
if sweepBear
line bearSweepLine = line.new(liqLastHighIndex, liqLastHigh, bar_index, liqLastHigh, color = i_liqBuysideCol, style = line.style_solid)
box bearSweepBox = liqNewSweepBox(high, liqLastHigh, i_liqBuysideCol)
When a sweep occurs, the script draws two things:
a line showing the swept liquidity level,
and a box covering the swept excursion beyond that level.
This makes the sweep visually clear by showing both the reference price and the actual penetration area.
16) Fibonacci Anchoring From Latest Structure Break
bool fibCanDraw = i_showFib and lastStructBreakDir != 0 and not na(lastStructBreakIndex) and not na(lastStructBreakExtreme) and not na(lastStructOppPrice) and not na(lastStructOppIndex) and lastStructOppIndex != 0
The Fibonacci engine only draws when a valid structural break context exists.
The anchor requires:
a known break direction,
the latest break index,
the break extreme,
the opposing structural price,
and the opposing structural index.
So Fibonacci is not anchored arbitrarily. It is tied directly to the latest confirmed structural move.
17) Fibonacci Level Calculation
float a0 = lastStructBreakExtreme
float a1 = lastStructOppPrice
float r = a1 - a0
float p0 = a0 + r * 0.0
float p1 = a0 + r * 1.0
float pEq = a0 + r * i_fibEqLevel
float pOteLow = a0 + r * i_fibOteLow
float pOteMid = a0 + r * i_fibOteMid
float pOteHigh = a0 + r * i_fibOteHigh
This is the actual Fibonacci math.
The script defines the range between the break extreme and the opposing structural point, then calculates all Fibonacci levels as proportions of that range.
That includes:
the zero level,
the one level,
equilibrium,
the OTE low,
the OTE midpoint,
and the OTE high.
Optional extra levels can also be added in the same way.
So the Fibonacci framework always adapts to the latest structural swing rather than staying fixed to older price action.
18) Killzone Session Detection
string kzTz = "UTC-5"
kzInSession(string sess) =>
not na(time(timeframe.period, sess, kzTz))
bool inAsian = kzInSession("2000-0000")
bool inLondon = kzInSession("0200-0500")
bool inNY = kzInSession("0830-1100")
bool inLondonC = kzInSession("1330-1600")
Killzones are detected through session time windows defined in UTC 5.
Each session is converted into a boolean state that says whether the current bar falls inside that time window. This becomes the input for the killzone renderer.
So session marking is time based rather than manually positioned.
19) Killzone Box and Range Update Logic
if isActive
if not wasActive or na(sBox)
sBox := box.new(left = time, top = high, right = time, bottom = low, xloc = xloc.bar_time, bgcolor = baseCol, border_color = color(na), border_width = 0, text = boxTxt, text_color = tC, text_size = size.tiny, text_halign = text.align_left, text_valign = text.align_top)
float prevTop = box.get_top(sBox)
float prevBot = box.get_bottom(sBox)
float newTop = math.max(prevTop, high)
float newBot = math.min(prevBot, low)
box.set_top(sBox, newTop)
box.set_bottom(sBox, newBot)
box.set_right(sBox, time)
When a killzone begins, the script creates a new box using the current bar’s range. As the session continues, it keeps updating the top and bottom to reflect the highest high and lowest low made during that session.
So each killzone box becomes both a time marker and a session range marker. Indicator

Auto Fair Value Gap (FVG) Pro [identityKa]Overview
The Auto Fair Value Gap (FVG) Pro is an essential Smart Money Concepts (SMC) tool engineered to detect and highlight institutional price imbalances. An FVG occurs when strong momentum creates a gap in price delivery, leaving an inefficiency between buyers and sellers. This script mathematically identifies these 3-bar structures in real-time, plotting them as dynamic zones. It goes a step further by offering automated chart mitigation (cleaning) and plotting the highly sought-after 50% Consequent Encroachment (CE) level.
Core Detection & Mitigation Mechanics
The algorithm evaluates price action strictly based on a 3-candle sequence:
Bullish FVG (Demand Imbalance): Identified when the Low of the 3rd candle is strictly higher than the High of the 1st candle, and the 2nd candle is bullish. This creates an unmitigated gap of buy-side liquidity.
Bearish FVG (Supply Imbalance): Identified when the High of the 3rd candle is strictly lower than the Low of the 1st candle, and the 2nd candle is bearish. This creates a sell-side imbalance.
Smart Mitigation (Wick vs. Close): The script allows the user to define what constitutes a "filled" gap. In "Wick" mode, the gap is instantly deleted from the chart the moment a subsequent candle's wick sweeps through the zone. In "Close" mode, the gap remains active until a candle's body strictly closes inside or beyond the zone, ensuring the chart stays clean and only relevant institutional targets remain visible.
The Consequent Encroachment (50% CE)
Institutions frequently target the exact middle of an imbalance. By default, this script draws a dashed line at the exact 50% mathematical equilibrium of every active FVG box. This serves as a precise entry point or target for advanced SMC traders.
HUD Dashboard & AI Logic
The integrated panel provides an instant read on the imbalance bias and risk state:
Dangerous: Displayed whenever the current live price action enters an active FVG zone. This signifies that the gap is actively being filled and high volatility is expected as orders are absorbed.
LONG: Triggered when the last detected FVG was Bullish, indicating that recent institutional momentum was upward and unmitigated demand zones lie below as support.
SHORT: Triggered when the last detected FVG was Bearish, indicating a dominance in sell-side momentum.
How to Use It
This tool is exceptionally powerful for Price Action trading, particularly on 15-minute and 1-hour timeframes where intraday institutional gaps frequently occur and are reliably filled. Traders should not blindly buy or sell when an FVG forms. Instead, use the FVG boxes as high-probability reversal zones. When the AI Suggestion reads "Dangerous" (price is inside the gap), monitor the price action on a lower timeframe. Wait for a rejection from the box—specifically near the 50% CE dashed line—before executing a trade in the direction of the macro trend. Indicator

Indicator

Fair Value Gap Rejection AlertsOverview
The Fair Value Gap (FVG) Finder is a versatile Pine Script™ v6 indicator designed to identify price inefficiencies in the market, commonly known as Fair Value Gaps. These gaps represent areas where price has moved rapidly, leaving behind unbalanced regions that often act as support or resistance levels. This script highlights bullish (upward) and bearish (downward) FVGs as colored boxes on your chart, making it easy to spot potential reversal or continuation zones.
Building on standard FVG concepts, this indicator includes advanced features like automatic rejection detection. A rejection occurs when price wicks into the FVG but closes outside it, signaling a potential bounce without filling the gap. Bullish rejections (support bounces) are marked with green upward triangles below the bar, while bearish rejections (resistance bounces) use red downward triangles above the bar. Only the first rejection per FVG is tagged to avoid clutter.
The script also supports alerts for these rejections, allowing you to set up notifications in PulseWire for timely trading decisions. Gaps are drawn for a user-defined length but can detect rejections and fills beyond the visible box if needed.
Key Features
FVG Detection: Automatically identifies bullish FVGs (green boxes) when there's an upward price gap exceeding the minimum size, and bearish FVGs (red boxes) for downward gaps.
Rejection Logic: Detects wick-based rejections without gap filling. Bullish: Low enters the FVG but close is above. Bearish: High enters but close is below.
Alerts: Separate alerts for bullish and bearish rejections, configurable via PulseWire's alert system (use "alert() function calls only").
Visual Tags: Triangles mark rejection candles for quick visual confirmation.
Customization: Inputs include gap length, minimum gap size (manual or ATR-based), option to show only the latest gap, and delete filled gaps. Style options for colors, label sizes, and more.
Filling Mechanism: Optionally deletes boxes once price fully closes into the gap, indicating it's been mitigated.
How to Use
Add the indicator to your chart via PulseWire's Pine Editor.
Adjust inputs in the settings panel:
Gap Length: Controls how far the box extends (default: 60 bars).
Minimum Gap Size: Set manually or auto-adjust with ATR(14) for adaptive filtering.
Only Show Latest Gap: Limits display to the most recent FVG.
Delete Filled Gaps: Removes boxes after price fills them.
Styles: Customize colors and label sizes for better visibility.
Monitor the chart for FVG boxes. Watch for triangle shapes indicating rejections—these often signal entry points (e.g., buy on bullish rejection).
Set up alerts: In PulseWire, create alerts based on the indicator's "Bullish FVG Rejection" or "Bearish FVG Rejection" conditions.
Best used on timeframes like 5M-1H for intraday trading, or higher for swing setups. Combine with other tools like volume or trend lines for confirmation.
This indicator is inspired by Inner Circle Trader (ICT) and Smart Money Concepts (SMC) but includes original enhancements like per-gap rejection tracking to prevent multiple signals on the same zone. It does not guarantee profits and should be used as part of a broader strategy with proper risk management.
No external dependencies or subscriptions required—fully self-contained in Pine Script™ v6. Indicator

Pattern Recognition Signals | ProjectSyndicatePattern Recognition Signals automatically identifies and validates high-probability, non-repainting Double Top and Double Bottom patterns. It filters for structural quality, calculates adaptive take-profit and stop-loss zones based on Average Daily Range (ADR), and presents a complete statistical breakdown on a non-intrusive dashboard to provide a quantifiable edge.
🧠 NRP Multi-Wave Detection — identifies classic Double (W/M) and Triple (W/M) patterns using a non-repainting pivot engine, ensuring signals are confirmed and stable.
🎯 ADR-Adaptive TP/SL Zones — automatically calculates and plots TP1, TP2, and SL zones based on a percentage of the 10-day ADR, allowing the strategy to dynamically adapt to any asset's volatility.
🎨 Direction-Matched Colors — Bullish pattern labels are colored green to match the TP zones, and Bearish labels are colored red to match the SL zone, providing instant visual confirmation of trade direction.
📊 Full Performance Dashboard — provides a complete statistical overview, including the real-time ADR10 value, total signals, win rates for TP1/TP2, and a log of the last 10 trade outcomes.
✅ Advanced Quality Control Filters — user-configurable inputs for Max Pattern Bars, Max Pattern Height (% of ADR10), and Min Bars Between Signals eliminate low-quality or excessively large patterns and prevent over-signaling.
🔔 Comprehensive Alerts — get a single, detailed alert per signal—including the symbol, timeframe, entry price, SL, TP1, and TP2—formatted for easy integration with automated trading systems.
🔧 Fully Customizable — control everything from pivot lengths and pattern quality filters to the colors and extension of all zones, labels, and dashboard elements.
🎯 Why this algo is unique: Standard ZigZag and pattern indicators are notorious for repainting and providing subjective signals with no statistical backing. This algorithm provides an objective, fully-gated, non-repainting signal engine. It doesn’t just draw a pattern; it builds a complete, quantifiable trading framework around it with adaptive risk management (ADR-based zones) and a dashboard to prove its historical performance on the chart you are trading.
🚀 Apply to Gold (XAUUSD), Forex, Crypto, and Indices on any M5/M10/M15/M30/H1. The ADR-based system and extensive quality filters allow it to adapt to anything from M5 scalping to H4 swing trading.
🎯 How to use this? Use the dashboard to understand the strategy's recent performance on the current asset/timeframe. Adjust the TP/SL and pattern filter percentages to match your risk tolerance. Consider taking trades that align with the higher-timeframe trend for higher probability setups.
⚠️ IMPORTANT NOTICE: This indicator is designed to identify statistically-backed pattern signals. It should NOT be used as a standalone signal for entering trades. Always use it in conjunction with your own trading strategy, price action analysis, and other technical indicators to confirm trade setups and manage risk. Indicator

Indicator

Smart Money Engine [WillyAlgoTrader]Smart Money Engine (SME) is a comprehensive overlay indicator that automates the core elements of Smart Money Concepts (SMC) analysis: multi-layer market structure detection (BOS / CHoCH), order block identification with strength grading, fair value gap tracking with fill monitoring, inverse FVG generation, and auto-anchored Fibonacci retracement — all in a single, unified tool.
Rather than stacking five separate indicators on your chart — one for structure, one for OBs, one for FVGs, one for IFVGs, and one for Fibonacci — SME integrates these components so they share a common structural context. Order blocks are created at actual structure break points, FVGs are filtered against volatility, IFVGs are born from filled FVGs, and the Fibonacci grid automatically anchors to the current strong high and strong low. Every component is aware of the others, producing a cleaner and more logically consistent chart than layering independent tools.
🔍 WHAT MAKES IT ORIGINAL
1. Dual-layer structure detection (Swing + Internal). The indicator runs two independent pivot-based structure engines simultaneously. The Swing layer (configurable length, default 10) captures major market structure — the higher-timeframe trend. The Internal layer (shorter length, default 5) captures minor structure shifts within the swing trend. Both label BOS (Break of Structure — continuation) and CHoCH (Change of Character — reversal) independently. This dual-layer approach lets you see whether an internal CHoCH is happening against or with the swing trend — a key distinction in SMC methodology that single-layer tools miss.
2. Order Blocks with contextual grading (A / B / C). OBs are not placed at arbitrary candles. They are created only when a swing-level BOS or CHoCH occurs — the script walks back from the break to find the last opposite-colored candle (the institutional candle that initiated the move). Each OB is then graded:
— Grade A : OB overlaps with an FVG and has a volume spike (highest confluence)
— Grade B : OB has one confluence factor (volume spike OR FVG overlap)
— Grade C : basic OB without additional confluence
Grading helps you prioritize which zones to trade from. OBs extend until mitigated (user choice: close-based or wick-based mitigation), and each OB displays a Consequent Encroachment (CE) midline — the 50% level that often acts as the reaction point within the block.
3. Fair Value Gaps with ATR auto-filter and fill tracking. FVGs are detected using the classic three-candle gap method (current low > high two bars ago for bullish, inverse for bearish). A built-in ATR filter (enabled by default) suppresses FVGs smaller than 0.5× ATR, removing the micro-gaps that clutter charts on lower timeframes. Each FVG extends until fully filled, displays a CE midline, and is automatically removed once price closes through the gap.
4. Inverse FVG (IFVG) generation. When an FVG is fully filled by price, it doesn't just disappear — it transforms into an Inverse FVG with flipped bias. A filled bullish FVG becomes a bearish IFVG (potential resistance); a filled bearish FVG becomes a bullish IFVG (potential support). This captures the SMC concept that once institutional imbalance is filled, the zone can flip polarity. IFVGs are displayed with distinct dashed borders and tracked until mitigated by a close through their zone.
5. Auto-anchored Fibonacci retracement. The Fibonacci grid automatically spans from the current Strong High to Strong Low — the trailing extremes of the active swing structure. When a new BOS/CHoCH shifts the structure, the anchor points update and the grid repositions. The OTE (Optimal Trade Entry) zone between 0.5 and 0.618 is highlighted, giving you an immediate visual reference for the premium/discount equilibrium.
6. Strong / Weak High and Low levels. After each structural break, the indicator identifies the trailing high and low as either "Strong" or "Weak" based on their position relative to the current trend direction. In a bullish swing, the low that initiated the trend is the Strong Low (protected) and the high is the Weak High (target). These levels are extended forward as dashed lines, providing clear reference for where the trend is protected and where it is vulnerable.
⚙️ HOW IT WORKS
Structure detection:
Swing pivots are identified using ta.pivothigh() and ta.pivotlow() with the configured lookback length. The script maintains the most recent swing high and swing low. When price closes above the previous swing high (confirmed bar close, no mid-bar signals), it registers a bullish break. If the prior trend was bearish, this is labeled CHoCH (reversal); if bullish, it is labeled BOS (continuation). The same logic applies in reverse for bearish breaks. Internal structure uses an identical algorithm with a shorter lookback, and its labels are drawn with dashed lines and lighter opacity to visually distinguish them from swing-level events.
Order Block detection:
When a swing-level break is confirmed, the script scans backward (up to 30 bars) from the pivot that was broken to find the last candle with opposite polarity — the candle whose body direction opposes the break direction. The full range (high to low) of that candle becomes the OB zone. A volume spike check (volume > 1.5× 20-period SMA) adds confluence for grading. OBs extend right until the mitigation condition is met.
FVG detection:
On every confirmed bar, the script checks whether the current bar's low exceeds the high of two bars ago (bullish FVG) or the current high is below the low of two bars ago (bearish FVG). If the gap size passes the ATR filter, an FVG box is created. The box extends right each bar. If price fills the gap completely (low touches the bottom of a bullish FVG, or high touches the top of a bearish FVG), the FVG is removed and — if IFVG mode is enabled — queued for conversion to an Inverse FVG.
HTF trend filter:
An optional higher-timeframe EMA(50) filter provides directional bias. The HTF data is fetched using request.security() with confirmed-bar referencing ( + lookahead_on pattern) to prevent repainting. When enabled, the dashboard displays the HTF bias, and the confluence can factor into OB grading.
Anti-repaint compliance:
All structure breaks, OB creation, and FVG detection require barstate.isconfirmed — signals fire only after the bar closes. The HTF filter uses the standard non-repainting security call pattern. No future data is accessed.
📖 HOW TO USE
Reading the chart:
— HH / HL / LH / LL labels at swing points classify the market structure
— Solid horizontal lines with BOS or CHoCH labels = swing-level structure breaks
— Dashed lines with BOS/CHoCH = internal (minor) structure breaks
— Colored boxes = Order Blocks (green-tinted = bullish, red-tinted = bearish)
— Letter labels (A/B/C) on OBs = strength grade
— Dotted midline inside OBs = Consequent Encroachment (CE)
— Blue-tinted boxes = bullish FVGs; orange-tinted = bearish FVGs
— Dashed-border boxes labeled IFVG = Inverse Fair Value Gaps
— Dotted horizontal Fibonacci lines with OTE zone highlight = auto retracement grid
— Dashed trailing lines labeled "Strong High/Low" or "Weak High/Low" = structural extremes
Suggested workflow:
— Identify the swing trend direction from BOS/CHoCH labels and Strong/Weak levels
— Check if internal structure aligns with or diverges from swing structure
— Look for entry opportunities at Order Blocks (prioritize Grade A/B) within the Fibonacci OTE zone
— Use FVGs as additional confluence — a bullish OB that overlaps a bullish FVG is a higher-probability zone
— Monitor IFVGs for polarity-flipped zones that may act as new support/resistance
— Use the dashboard to track active OB/FVG/IFVG counts and HTF bias alignment
Timeframe guidance:
— Scalping (1–5min): Swing Length 5–7, Internal 3, increase Max OBs/FVGs for more zones
— Intraday (15min–1H): Swing Length 8–12, Internal 5, default settings work well
— Swing (4H–Daily): Swing Length 15–25, Internal 7–10, reduce Max OBs to keep chart clean
— Use the HTF filter with 1 step up (e.g. 1H chart → 4H HTF, 4H chart → D HTF)
⚙️ KEY SETTINGS REFERENCE
— Swing Detection Length (default 10): lookback for major structure pivots
— Internal Structure Length (default 5): lookback for minor structure pivots (should be < Swing Length)
— OB Mitigation (default Wick): "Close" = OB removed on close through zone; "Wick" = removed on any touch
— Show OB Grade (default On): display A/B/C strength classification on OBs
— Show OB Midline (default On): display CE (50%) line inside order blocks
— Auto-Filter Small FVGs (default On): suppress FVGs smaller than 0.5× ATR
— Max Visible OBs / FVGs / IFVGs (default 5 each): cap on displayed zones to manage chart clutter
— Show Inverse FVGs (default Off): enable IFVG generation from filled FVGs
— Show Fibonacci Retracement (default On): auto-anchored grid with OTE zone highlight
— HTF Trend Filter (default Off): set a higher timeframe for directional bias via EMA(50)
— Volume Confirmation (default On): add confluence when volume > 1.5× average (auto-disabled on forex)
📊 Dashboard
The info panel (adjustable to any chart corner) displays in real time:
— Swing trend direction (Bullish / Bearish)
— Internal trend direction
— Fibonacci range (Strong High — Strong Low)
— Count of active OBs, FVGs, and IFVGs
— HTF bias (if enabled)
— Current timeframe and indicator version
⚠️ IMPORTANT NOTES
— This indicator does not repaint. All signals and zone creations require bar-close confirmation. The HTF filter uses the standard + lookahead_on non-repainting pattern.
— SME is a structural analysis and zone-mapping tool — it identifies where institutional activity likely occurred, but it does not generate explicit buy/sell signals. Trade decisions should incorporate your own entry triggers, risk management, and additional confluence.
— Past structure patterns and zone reactions do not guarantee future price behavior.
— Performance may vary across instruments and timeframes. Lower timeframes produce more zones and structure shifts; use the ATR filter and Max Visible caps to manage noise.
— The indicator works across all asset classes. Volume-based features (OB grading) are automatically adjusted on instruments without volume data. Indicator

Fair Value Gap Signals [UAlgo]Fair Value Gap Signals is a price action indicator that detects bullish and bearish Fair Value Gaps and then tracks how price behaves inside those gaps over time. Instead of only drawing static imbalance boxes, the script treats each FVG as a stateful object with live metrics, lifecycle states, mitigation logic, and optional rejection signals. This makes it useful for traders who want both structural FVG mapping and real time interaction analysis after the gap is created.
The indicator runs on price ( overlay=true ) and automatically identifies classic 3 candle FVG formations. Each detected gap is stored in an internal object with its own box, CE midline, metric bars, status, and signal label handling. As price revisits a gap, the script measures how deeply price penetrates the zone, how much volume is accumulated during tests, and how strong the test candles are in terms of directional body expansion (velocity style scoring).
A key design goal of this script is practical decision support. It can show:
Fresh gaps
Testing behavior
Filled or invalidated gaps
Rejection events (potential reversal signals)
Live VVD style metrics (Velocity, Volume, Depth / Safety) inside the FVG
It also includes an ATR filter to ignore small gaps, visibility limits to keep charts clean, optional CE midline plotting, and alert conditions for major gap events.
🔹 Features
🔸 1) Automatic Bullish and Bearish FVG Detection
The script detects standard 3 candle Fair Value Gaps using simple price displacement logic:
Bullish FVG when current low is above high from two bars ago
Bearish FVG when current high is below low from two bars ago
When a gap is confirmed, it is stored as a custom Gap object and immediately drawn on the chart with its own box, CE midline, and metric containers.
🔸 2) Stateful FVG Lifecycle Tracking
Each gap is tracked through multiple statuses instead of being treated as a static box:
Fresh
Testing
Tested
Rejected
Filled
This allows the indicator to model how price interacts with a gap over time and not just where the gap originally formed.
🔸 3) Configurable Mitigation Method (Close or Wick)
Users can choose how FVG mitigation is confirmed:
Close means invalidation requires a close through the far boundary
Wick means a wick touch through the far boundary is enough
This is a very useful option because traders often use different mitigation definitions depending on instrument and timeframe.
🔸 4) ATR Based Gap Size Filter
An optional ATR filter removes smaller gaps that may be insignificant in volatile conditions. When enabled, the script ignores bullish or bearish FVGs whose size is smaller than the current ATR value (using the chosen ATR length).
This helps reduce noise and keeps the display focused on stronger imbalances.
🔸 5) CE Midline (Consequent Encroachment) Support
Each FVG can display a dotted midline representing the center of the gap (Consequent Encroachment). This gives traders an additional reference inside the imbalance and is commonly used as a reaction level in ICT style workflows.
The CE line can be turned on or off with a dedicated input.
🔸 6) VVD Metrics Inside Each Gap (Velocity, Volume, Depth)
One of the strongest features of this script is the live metric visualization inside every active gap. The indicator tracks and displays three bar style metric boxes:
Velocity
Volume
Depth (rendered as a safety style score from penetration depth)
These metrics update as price tests the gap and provide a quick visual estimate of test quality, participation, and penetration risk.
🔸 7) Rejection Signal Detection with Context
When price enters a gap and then rejects from it with sufficient test volume, the script can print a directional signal label. Bullish gaps can generate Buy or Strong Buy labels and bearish gaps can generate Sell or Strong Sell labels.
Signal strength is influenced by the velocity metric, and the tooltip includes extra details such as velocity score, volume score, safety score, and test count.
🔸 8) Test Counting and Multi Test Awareness
The indicator keeps track of how many times a gap has been tested. This can help traders distinguish first touch behavior from repeated interactions that may weaken the setup.
The test count can also be displayed as text inside the main FVG box when metrics are enabled.
🔸 9) Visibility Control for Cleaner Charts
To avoid clutter, the script limits how many active bullish and bearish gaps are visually displayed at once using Max Visible FVGs . It scans from newest to oldest and only shows the most recent valid gaps per side.
Older or non visible gaps still exist in logic and continue updating internally, but their visuals are hidden.
🔸 10) Smart Object Cleanup and Retained Signal Labels
The script enforces an internal gap limit and removes older gap objects when needed. Gap boxes, CE lines, and metric boxes are deleted during cleanup, while rejection labels are intentionally allowed to remain on the chart for historical context.
This gives users a cleaner display while preserving past signal markers.
🔸 11) Alert Conditions for Key FVG Events
Built in alert conditions are provided for:
New FVG formed
FVG testing (price enters a gap)
FVG filled (mitigated / invalidated)
FVG rejection signal (potential reversal)
This makes the script suitable for active monitoring across multiple charts or watchlists.
🔹 Calculations
1) Bullish and Bearish FVG Detection Logic
The script uses classic 3 candle gap conditions:
bool fvgBull = low > high
bool fvgBear = high < low
Interpretation:
A bullish FVG exists when the current candle low leaves a gap above the high from two bars ago.
A bearish FVG exists when the current candle high leaves a gap below the low from two bars ago.
When detected, the script creates a Gap object and stores:
Top boundary
Bottom boundary
Direction
Origin index
Status and metrics
Visual objects (main box, metric boxes, midline, label handle)
2) ATR Filter for Minimum Gap Size
If the ATR filter is enabled, the script compares gap size with ATR and rejects undersized gaps:
float atrVal = ta.atr(atrLength)
float gapSizeBull = low - high
float gapSizeBear = low - high
if fvgBull and gapSizeBull < atrVal
fvgBull := false
if fvgBear and gapSizeBear < atrVal
fvgBear := false
This creates a volatility adjusted threshold for FVG relevance.
3) Gap Object Initialization and Visual Construction
When a new gap is created, the setup method initializes both state and visuals:
Main FVG box
CE midline
Three metric boxes (Vel, Vol, Dpt)
The main box is drawn from the origin index to a small forward projection:
g.paramBox := box.new(left = idx, top = top, right = bar_index + 5, bottom = bottom, ...)
The CE line is placed at the midpoint:
float midY = (top + bottom) / 2
The metric area is split into three horizontal segments inside the gap height so each metric can expand in width over time.
4) Gap Status Model and State Transitions
Each gap starts as Fresh . As price interacts with the gap, the script can move it through:
Testing when price enters the zone
Tested when price leaves after a test
Rejected when rejection conditions are met
Filled when mitigation occurs
This logic is implemented inside the update() method, which runs every bar for each stored gap.
5) Test Detection and First Touch Handling
The script avoids counting the forming bar as a test:
bool canTest = bar_index > g.index + 1
A gap is considered under test when the current candle range overlaps the gap:
bool isInside = canTest and (h >= g.bottom and l <= g.top)
When price first enters a fresh gap:
if g.status == "Fresh"
g.status := "Testing"
g.testCount := 1
g.testStartVolume := volume
eventCode := 1
This event code is later used for the FVG Testing alert condition.
6) Velocity Metric Calculation
Velocity is a bar quality style score calculated during gap tests. It combines body dominance and a directional bonus:
float bodyRatio = math.abs(close - open) / barRange
Directional bonus:
Bullish gap gets bonus if the test candle closes bullish
Bearish gap gets bonus if the test candle closes bearish
float currentVelocity = math.min(bodyRatio + directionBonus, 1.0)
The gap stores the maximum velocity observed across all tests:
if currentVelocity > g.maxVelocity
g.maxVelocity := currentVelocity
Interpretation:
Higher velocity suggests stronger directional response while testing the gap.
7) Volume Metric Calculation
During tests, the script accumulates test volume:
if isInside
g.testVolume += volume
Later, it compares the accumulated test volume to an expected volume estimate:
float expectedVol = volAvg * math.max(1, (bar_index - g.index) / 2)
float volScore = math.min(g.testVolume / expectedVol, 1.0)
This creates a normalized volume score used in both the metric bar length and the rejection label tooltip.
8) Depth Metric and Safety Score Calculation
Depth tracks how far price penetrates into the gap during tests.
For bullish gaps:
Depth is measured from gap top downward when price dips below the top boundary.
For bearish gaps:
Depth is measured from gap bottom upward when price rises above the bottom boundary.
Examples:
if g.isBullish
if l < g.top
currentDepth := g.top - l
else
if h > g.bottom
currentDepth := h - g.bottom
The maximum penetration depth is stored:
if currentDepth > g.maxDepth
g.maxDepth := currentDepth
The displayed metric is a safety style score:
float depthRatio = g.maxDepth / gapSize
float safetyScore = math.max(0.0, 1.0 - depthRatio)
Interpretation:
Deeper penetration reduces safety score and may imply weaker rejection quality.
9) Fill / Mitigation Logic (Close or Wick)
A gap is marked Filled when price crosses the far boundary in the inverse direction, according to the selected mitigation method:
if mitType == "Close"
filledInverse := g.isBullish ? (close < g.bottom) : (close > g.top)
else
filledInverse := g.isBullish ? (l < g.bottom) : (h > g.top)
When filled:
Status becomes Filled
Gap is deactivated
Event code becomes 2
Gap visuals are deleted
This event code feeds the FVG Filled alert condition.
10) Rejection Signal Logic
Rejection is checked only while the gap is active and price is inside the gap. The script also requires enough accumulated test volume:
if isInside and g.testVolume > volAvg * 0.5
Rejection condition:
Bullish gap rejection if price probes below the gap top and closes back above the gap top
Bearish gap rejection if price probes above the gap bottom and closes back below the gap bottom
bool rejected = g.isBullish ? (l < g.top and close > g.top) : (h > g.bottom and close < g.bottom)
When rejection is confirmed:
Gap status becomes Rejected
Optional signal label is drawn (Buy, Strong Buy, Sell, Strong Sell)
Event code becomes 3
This event code feeds the FVG Rejection Signal alert condition.
11) Signal Strength and Tooltip Metrics
When a rejection signal is printed, the script builds a tooltip with normalized scores:
Velocity score from maxVelocity
Volume score from testVolume versus expectedVol
Safety score from gap penetration depth
Test count
It also upgrades the signal text to Strong Buy or Strong Sell when max velocity exceeds 0.6:
if g.maxVelocity > 0.6
icon := g.isBullish ? "Strong Buy" : "Strong Sell"
This provides a compact label with deeper context available on hover.
12) Visibility Limiting and Render Hiding
The script iterates through gaps from newest to oldest and shows only the most recent active bullish and bearish gaps up to maxVisible per side. Non visible gaps are not deleted, but their visuals are hidden by setting colors and text to na .
This is useful for traders who want a focused view of current opportunities without losing older gap state tracking in the background.
13) Metric Bar Rendering Logic
Each metric box grows horizontally from the gap origin according to a normalized score:
Velocity length from maxVelocity
Volume length from volScore
Depth / Safety length from safetyScore
Example:
int len1 = int(math.max(1, maxWidth * velScore))
g.rankBox1.set_right(g.index + len1)
If metric display is disabled, the script hides the metric boxes and text while keeping the gap logic active.
14) Array Cleanup and Object Management
The script enforces a strict gap storage limit with GAP_LIMIT . When exceeded, the oldest gap is removed and its visuals are deleted:
if gaps.size() > GAP_LIMIT
gaps.cleanup()
The cleanup method deletes:
Main gap box
CE midline
Velocity metric box
Volume metric box
Depth metric box
Rejection info labels are intentionally preserved for historical review.
15) Alert Conditions
The script exposes four alert conditions:
alertcondition(fvgBull or fvgBear, "New FVG Formed", ...)
alertcondition(anyTesting, "FVG Testing", ...)
alertcondition(anyFilled, "FVG Filled", ...)
alertcondition(anySignal, "FVG Rejection Signal", ...)
These alerts are driven by the live event codes returned from each gap's update() call and make the indicator suitable for workflow automation. Indicator

ICT Unicorn Model [UAlgo]ICT Unicorn Model is a chart overlay indicator that automates a practical interpretation of the ICT “Unicorn” concept by combining two core components: a Market Structure Shift style Breaker Block (BB) and a Fair Value Gap (FVG). The script first builds a rolling pivot map using configurable left and right pivot bars, then monitors those pivots for structure breaks that qualify as bullish or bearish breaker blocks. Separately, it detects 3 candle FVG imbalances with a minimum size filter. A Unicorn is confirmed when a newly printed FVG overlaps an active breaker block of the same direction.
The output is built for real trading workflows and chart readability. Breaker blocks and FVGs can exist independently, but when they align, the script highlights the overlap region as a Unicorn zone and labels it. All zones extend forward in time and are automatically removed when mitigation or invalidation conditions are met. Optional session filtering is included to restrict detection to a specific trading window for killzone style usage.
Educational tool only. Not financial advice.
🔹 Features
🔸 1) Pivot Based Structure Mapping
The indicator uses built-in pivot detection to create a reliable swing framework. Both pivot highs and pivot lows are stored as structured objects that keep track of pivot time, bar index, pivot price, pivot direction, and whether that pivot has already been “broken” to prevent repeated processing. This pivot map becomes the backbone of the breaker block engine, allowing the script to reference meaningful swing points instead of reacting to minor noise.
🔸 2) Breaker Block Detection via Market Structure Shift Logic
Breaker blocks are created when price breaks through an unbroken pivot in a way that signals a directional shift in structure.
Bullish Breaker Block: price closes above an unbroken pivot high, then the script validates the context by locating two pivot lows around that pivot high and requiring a lower low relationship between them (LL style confirmation in this implementation). Once confirmed, a bullish breaker block zone is stored using the pivot candle’s full range.
Bearish Breaker Block: price closes below an unbroken pivot low, then the script validates the context by locating two pivot highs around that pivot low and requiring a higher high relationship between them (HH style confirmation in this implementation). Once confirmed, a bearish breaker block zone is stored using the pivot candle’s full range.
🔸 3) Fair Value Gap Detection with Minimum Size Filter
The FVG engine detects classic 3 candle price imbalances:
Bullish FVG: current low is above high from two bars ago.
Bearish FVG: current high is below low from two bars ago.
A minimum FVG size filter is applied using raw price points so you can ignore tiny gaps that are usually filled immediately. This makes the script easier to adapt across different markets and timeframes.
🔸 4) Unicorn Confirmation via Directional Overlap
A Unicorn is confirmed only when a newly printed FVG overlaps an active breaker block and both are in the same direction. The overlap test is a standard price interval intersection check, and the direction match ensures bullish FVGs only confirm bullish unicorns and bearish FVGs only confirm bearish unicorns.
When a Unicorn is confirmed, the script draws a dedicated Unicorn zone covering the combined overlap footprint and prints a simple Bull or Bear label directly on the chart.
🔸 5) Optional Session Filter for Killzone Style Workflows
A session filter can restrict detection to a specific time window. If enabled, the script only runs breaker block detection, FVG detection, and Unicorn confirmation while the current bar is inside the selected session. This is useful when you only want signals during higher participation windows.
🔸 6) Automatic Forward Extension, Mitigation, and Cleanup
All zones behave as live objects:
Breaker block boxes extend forward until invalidation.
FVG boxes extend forward until mitigation.
Unicorn boxes extend forward until the associated FVG mitigation condition is met.
When a zone is mitigated or invalidated, its box and label objects are deleted and removed from internal arrays. This keeps the chart clean and prevents stale zones from accumulating.
🔸 7) Object and Memory Management for Chart Stability
The script uses arrays of custom types (Pivot, BreakerBlock, FVG, Unicorn) and enforces internal history limits to reduce clutter and object growth. Older items are shifted out when limits are exceeded, and graphical objects are deleted when no longer valid to maintain stable chart performance.
🔹 Calculations
1) Time Filter (Session Gate)
If the time filter is disabled, detection runs on every bar. If enabled, detection only runs when the chart time is inside the selected session.
in_session = not use_time_filter or time(timeframe.period, time_session) != 0
Interpretation:
If use_time_filter is false, in_session is always true.
If use_time_filter is true, time() returns non-zero only while the bar is inside the session.
2) Pivot Detection and Pivot Object Storage
Pivot highs and lows are detected using PulseWire pivot functions with user-defined left and right bars. Pivots are confirmed after right_bars bars, so the stored pivot time and bar index are offset by right_bars to align the pivot to the originating candle.
ph = ta.pivothigh(high, left_bars, right_bars)
pl = ta.pivotlow(low, left_bars, right_bars)
When a pivot is found:
array.unshift(pivots, Pivot.new(time , bar_index , ph, true, false, high , low ))
The pivot list is capped to keep the script lightweight:
if array.size(pivots) > 20
array.pop(pivots)
3) Bullish Breaker Block Detection
A bullish breaker is triggered when price closes above an unbroken pivot high. The script then searches for pivot lows around that pivot high and requires a lower low relationship between them. If this context check passes, the pivot is marked as broken and a bullish breaker block is stored.
if p.isHigh and not p.isBroken and close > p.price
...
if foundLL
p.isBroken := true
array.push(active_bbs, BreakerBlock.new(p.time, p.index, p.highPrice, p.lowPrice, true, true, na))
Breaker block zone definition is derived from the pivot candle:
Top = pivot candle high
Bottom = pivot candle low
4) Bearish Breaker Block Detection
A bearish breaker is triggered when price closes below an unbroken pivot low. The script then searches for pivot highs around that pivot low and requires a higher high relationship between them. If this context check passes, the pivot is marked as broken and a bearish breaker block is stored.
if not p.isHigh and not p.isBroken and close < p.price
...
if foundHH
p.isBroken := true
array.push(active_bbs, BreakerBlock.new(p.time, p.index, p.highPrice, p.lowPrice, false, true, na))
5) Fair Value Gap Detection and Sizing
Bullish FVG requires current low to be above high .
Bearish FVG requires current high to be below low .
A minimum size filter is applied in points:
bool isBullishFVG = low > high and (low - high ) >= fvg_min_volume
bool isBearishFVG = high < low and (low - high) >= fvg_min_volume
FVGs are stored with their start anchored to bar_index and time , matching the gap’s originating structure:
if isBullishFVG
array.push(active_fvgs, FVG.new(time , bar_index , low, high , true, false, na))
if isBearishFVG
array.push(active_fvgs, FVG.new(time , bar_index , low , high, false, false, na))
6) Overlap Rule for Unicorn Confirmation
A Unicorn requires overlap plus direction agreement. The overlap is calculated as an interval intersection:
method overlaps(BreakerBlock this, FVG fvg) =>
bool isOverlapping = (fvg.bottom <= this.top) and (fvg.top >= this.bottom)
isOverlapping and (this.isBullish == fvg.isBullish)
Interpretation:
The FVG range must intersect the breaker block range, and both must be bullish or both bearish.
7) Unicorn Zone Construction
When a new FVG prints, the script compares it against all active breaker blocks. If an overlap is found, it creates a Unicorn zone and a Bull or Bear label. The Unicorn box boundaries are computed using min and max edges between the BB and FVG:
float topEdge = math.min(bb.top, latestFVG.top)
float bottomEdge = math.max(bb.bottom, latestFVG.bottom)
The Unicorn zone is then drawn and extended forward.
8) Mitigation and Invalidation Logic
Breaker Block invalidation
Bullish BB invalidates if close goes below BB bottom.
Bearish BB invalidates if close goes above BB top.
if (bb.isBullish and close < bb.bottom) or (not bb.isBullish and close > bb.top)
bb.isActive := false
if not na(bb.bbBox)
box.delete(bb.bbBox)
array.remove(active_bbs, i)
FVG mitigation
Bullish FVG mitigates if close goes below FVG bottom.
Bearish FVG mitigates if close goes above FVG top.
if (fvg.isBullish and close < fvg.bottom) or (not fvg.isBullish and close > fvg.top)
fvg.isMitigated := true
if not na(fvg.fvgBox)
box.delete(fvg.fvgBox)
array.remove(active_fvgs, i)
Unicorn mitigation
Unicorn zones are removed when the associated FVG mitigation condition is met:
bool isMitigated = (uni.isBullish and close < uni.fvg.bottom) or (not uni.isBullish and close > uni.fvg.top)
if isMitigated
box.delete(uni.uniBox)
label.delete(uni.uniLabel)
array.remove(unicorns, i)
9) Forward Extension and Internal Limits
Boxes are extended on each bar by updating right = bar_index + 5 to keep them projected slightly forward. Arrays are capped to control history size and object usage:
if array.size(active_bbs) > 50
array.shift(active_bbs)
if array.size(active_fvgs) > 50
array.shift(active_fvgs)
if array.size(unicorns) > 50
array.shift(unicorns) Indicator

Fair Value Range Breakout [by Oberlunar]Fair Value Range Breakout by Oberlunar is a community tool built around higher-timeframe structure and HTF imbalance zones. It reconstructs and draws up to three recent candles from a user-selected HTF and optionally displays their High, Low, Open, and Close levels with configurable styles and colours, keeping HTF candles and FVG ranges readable while working on lower timeframes.
On each confirmed HTF candle close, the script scans the last three closed HTF candles to detect bullish and bearish Fair Value Gaps using either wicks or candle bodies as the reference. You can filter gaps by a minimum size in ticks, keep only the most recent zones, and extend zones to the right for ongoing interaction tracking.
Set the HTF timeframe according to your horizon, such as Daily for swing context or H4-H2 for intraday structure, then enable the HTF candle overlay and choose which OHLC levels to show for each candle. In the HTF FVG settings, pick Wicks for zones that reflect extremes or Bodies for tighter zones, and increase the minimum gap in ticks if you want fewer, cleaner zones. If you use signals, choose “Close inside” for stricter interaction requirements or “Wick touch” for earlier detection, and apply a small exit buffer in ticks when noise is high. A practical workflow is using HTF=2H on a 5m or 15m chart, monitoring price interaction with an HTF FVG zone, and treating the plotted signal as confirmation of a zone exit rather than a standalone entry system.
Attribution and derivative work notice is explicit and intentional.
The HTF candle architecture component is a derivative work based on HTF Candle Architecture by BigBeluga, and the HTF FVG engine is a derivative work based on “Fair Value Gap MTF” by Oberlunar.
The original references are provided above exactly and in the code as required.
Enjoy
Oberlunar 👁️★
Indicator

ICT MMM/AMD (Power of 3) [UAlgo]ICT MMM / AMD (Power of 3) is an intraday market structure framework that models the classic Accumulation, Manipulation, Distribution cycle using configurable killzones. The script tracks the Asia range as the accumulation anchor, looks for a liquidity sweep during the London window, waits for a Market Structure Shift confirmation, and then maps a clean entry model using Fair Value Gap logic and optional displacement requirements.
Beyond the core cycle, the indicator provides two additional layers of context:
Previous Day High and Previous Day Low levels for higher timeframe objectives
A dynamic Dealing Range built from recent pivots to visualize premium, discount, and equilibrium
The result is a structured workflow tool that organizes ICT style intraday logic into clear, step by step states with optional filters for cleaner execution.
🔹 Features
1) Session Based Cycle Engine (Killzones)
The script is built around three sessions selected by the user and evaluated in a chosen IANA timezone:
Accumulation window, typically Asia
Manipulation window, typically London
Distribution window, typically New York AM
Each day begins a new cycle at the start of the accumulation session. The script tracks the running high and low during accumulation, then finalizes those boundaries at the end of the session to create the reference range used by later steps.
2) Accumulation Range Mapping
During accumulation, the indicator maintains:
Accumulation High
Accumulation Low
Optional border only box around the session range
Optional ACC label
When the accumulation window ends, the high and low are frozen and drawn as clean horizontal guides using your selected line style and width.
3) Liquidity Sweep Detection With ATR and Tick Filters
During the manipulation window, the indicator checks for a sweep beyond the accumulation boundaries. The sweep threshold is adaptive and uses the larger of:
A minimum tick distance
A minimum ATR based distance
You can also choose whether sweep validation uses wicks or closes:
Wicks uses High and Low
Closes uses Close only
When a sweep is confirmed, the script labels it as BSL sweep if it sweeps above highs, or SSL sweep if it sweeps below lows. Optional sweep level and wick markers can also be drawn for precise reference.
4) Market Structure Shift Confirmation
After a sweep, the script waits for a Market Structure Shift using confirmed pivots. Pivot Length controls strictness. Higher values require cleaner structure and reduce false shifts, at the cost of added confirmation delay.
Bullish MSS is confirmed when price closes above the most recent confirmed pivot high after an SSL sweep
Bearish MSS is confirmed when price closes below the most recent confirmed pivot low after a BSL sweep
Optional MSS break lines can be displayed so you can see the exact level that defined the shift.
5) Displacement Qualification (Optional Gate Before FVG)
Displacement can be required before Fair Value Gap detection. This filter attempts to enforce a strong impulse candle after MSS by checking:
Body to range proportion
Body size relative to ATR
Directional strength by requiring a break beyond the prior candle extreme
This helps separate soft rotations from decisive expansions, which tends to improve FVG quality in many market conditions.
6) Fair Value Gap Detection and Management
After MSS, the script scans a configurable number of bars for a valid FVG.
Bullish FVG condition uses a three candle gap where the current low is above the high two bars ago
Bearish FVG condition uses a three candle gap where the current high is below the low two bars ago
Once an FVG is active, the script draws top and bottom boundary lines and optionally labels it. When price returns into the gap, the script treats it as mitigated. If the remove option is enabled, the FVG drawings are deleted after mitigation to keep the chart clean.
7) Entry Marking With Optional Distribution Filter
When price touches the active FVG, the script can print an ENTRY label and place a stop line.
Entry can be restricted to the distribution window if desired
This can reduce off session prints and align entries with the intended time of day logic
The stop level is anchored to the sweep extreme with an optional tick padding so you can adapt to spread and micro structure noise.
8) Target Framework Per Cycle
Targets are evaluated after MSS using your selected Target Mode:
PDH PDL only
Range only
PDH PDL plus Range
For bullish MSS, targets can include PDH and the accumulation high
For bearish MSS, targets can include PDL and the accumulation low
Target lines update forward and can stop extending once price hits them, keeping the cycle output visually informative without turning into permanent clutter.
9) Dealing Range Premium Discount Map
A Dealing Range is built from the most recent confirmed pivot high and pivot low using a separate pivot length setting. The script then computes:
Premium as the upper boundary
Discount as the lower boundary
Equilibrium as the midpoint
Optional labels mark DR PREMIUM, DR DISCOUNT, and DR EQ (50%) so you can quickly align entries with premium and discount logic.
10) Previous Day High and Low Overlay
PDH and PDL are pulled from the daily timeframe and drawn as global reference levels. These update at each new day and can be displayed with labels. This keeps higher timeframe objectives visible even when trading lower timeframes.
11) Visual Control and Cycle Retention
The indicator offers full control over:
Line styles
Line widths
Whether lines extend into the future
Whether to show boxes, labels, sweep lines, MSS lines, targets, and dealing range
Completed cycles are stored and older cycles are pruned based on Keep Last Cycles. This preserves recent context while keeping object counts under control.
🔹 Calculations
1) Session State Logic
Each session is evaluated using the chart timeframe, the session input, and the selected timezone. A cycle starts when the accumulation session turns on and ends when it turns off.
Conceptually:
inAcc is true when the current bar time falls inside the accumulation session
accStart is the transition from not inAcc to inAcc
accEnd is the transition from inAcc to not inAcc
These transitions control the lifecycle of each MMM cycle object.
2) Accumulation Range Construction
During accumulation, the script continuously updates the running high and low:
accHigh becomes the maximum observed high within the session
accLow becomes the minimum observed low within the session
At accEnd, these values are finalized and turned into horizontal range guides that define the boundaries used for sweep validation and optional range targets.
3) Sweep Threshold Model
Sweep threshold is a conservative maximum of two measurements:
Minimum sweep distance in ticks
Minimum sweep distance as a fraction of ATR
This creates a single threshold thr that adapts to volatility while still respecting a hard minimum in ticks.
Sweep evaluation then compares either:
High and Low if wicks are used
Close if closes are used
A sweep is confirmed when price probes beyond accHigh plus thr or beyond accLow minus thr.
4) MSS Pivot Framework
Confirmed pivots are used for structure shift validation. The script stores the most recent confirmed pivot high and pivot low and their bar indexes.
After a BSL sweep, bearish MSS triggers when close breaks below the last pivot low
After an SSL sweep, bullish MSS triggers when close breaks above the last pivot high
This ensures MSS is a structural confirmation rather than a subjective interpretation.
5) Displacement Filter Metrics
Displacement quality is checked using:
Body size relative to total candle range
Body size relative to ATR
Directional break beyond the previous candle extreme
Only when these requirements pass does the cycle allow the displacement flag, which can be used as a gate for FVG detection when enabled.
6) FVG Definition
The script uses a strict three candle gap model:
Bullish FVG when current low is above the high two bars ago
Bearish FVG when current high is below the low two bars ago
FVG is only searched within a fixed number of bars after MSS, which keeps the model aligned with the intended timing of the intraday cycle.
7) Mitigation and Entry Touch Logic
When an active FVG is present, a touch is defined as price overlapping the gap region. On the first touch:
If entry marking is enabled and the time filter allows it, the script prints ENTRY and places SL
FVG is marked as mitigated and can optionally be removed from the chart
Stop is computed from the sweep wick extreme plus optional tick padding, aligned with the idea that the sweep should remain the invalidation anchor.
8) Target Selection Logic
Targets are chosen based on direction and the Target Mode:
For bullish MSS, PDH can be Target A, accumulation high can be Target B
For bearish MSS, PDL can be Target A, accumulation low can be Target B
Targets are updated forward each bar and can stop extending once hit, which keeps the current cycle readable.
9) Dealing Range Computation
The dealing range uses the latest confirmed pivot high and pivot low:
DR high equals the higher of the two pivot prices
DR low equals the lower of the two pivot prices
DR equilibrium equals the midpoint of DR high and DR low
This provides a clean premium and discount map that updates as new pivots confirm.
10) Previous Day High and Low Retrieval
PDH and PDL are sourced from the daily timeframe using a security call that references the prior day values. They are reset at each new day, ensuring the lines represent the most recent completed daily range. Indicator

Smart Money Tracker [JOAT]Smart Money Tracker
Introduction
The Smart Money Tracker is an open-source indicator that combines institutional order flow concepts including Fair Value Gaps (FVG), Order Blocks (OB), Breaker Blocks, Liquidity Sweeps, Market Structure Breaks, and Displacement patterns. This mashup creates a comprehensive Smart Money Concepts (SMC) analysis system designed to identify where institutional traders are positioning themselves and how they manipulate price to accumulate or distribute positions.
The indicator addresses a fundamental market reality: institutional traders with large capital cannot simply buy or sell at market prices without moving the market against themselves. They must use sophisticated techniques including liquidity sweeps, gap creation, and order block manipulation. By tracking these institutional footprints simultaneously, this tool helps retail traders align with smart money rather than becoming their liquidity.
Chart showing FVG zones, Order Blocks, liquidity sweeps, and market structure on 15M timeframe
Why This Mashup Exists
This indicator combines six Smart Money Concepts that reveal different aspects of institutional behavior:
Fair Value Gaps (FVG): Inefficient price delivery zones where institutions moved price quickly
Order Blocks (OB): Last opposite-direction move before impulse, showing accumulation/distribution
Breaker Blocks: Failed Order Blocks that signal potential trend reversal
Liquidity Sweeps: Stop hunts where institutions trigger retail stops before real move
Market Structure: Break of Structure (BOS) and Change of Character (CHoCH) patterns
Displacement: Strong institutional moves with high volume and large candles
Each concept reveals different institutional tactics: FVGs show where they moved fast, Order Blocks show where they accumulated, Breaker Blocks show failed accumulation, Liquidity Sweeps show stop hunts, Market Structure shows control shifts, and Displacement shows strong directional intent. Together, they create a complete picture of institutional order flow that no single concept can provide.
The mashup is justified because these concepts work together in institutional trading sequences: institutions sweep liquidity, create FVGs during displacement, leave Order Blocks at accumulation zones, and break market structure when taking control. Tracking all simultaneously reveals the complete institutional playbook.
Core Components Explained
1. Fair Value Gap (FVG) Detection
FVGs occur when price moves so quickly that it leaves an unfilled gap:
// Bullish FVG: Current low > high from 2 bars ago
bullishFVG = low > high and close > high
fvgTop = low
fvgBottom = high
fvgSize = ((fvgTop - fvgBottom) / fvgBottom) * 100
// Bearish FVG: Current high < low from 2 bars ago
bearishFVG = high < low and close < low
fvgTop = low
fvgBottom = high
fvgSize = ((fvgTop - fvgBottom) / fvgBottom) * 100
FVG significance:
Represents inefficient price delivery - institutions moved too fast
Price often returns to "fill" these gaps before continuing
Larger FVGs (> 0.5%) are more significant
FVGs act as support/resistance zones
Multiple unfilled FVGs suggest strong directional intent
The indicator draws boxes for FVGs and tracks when they get "mitigated" (price returns to fill them). Timeframe-adaptive limits prevent clutter (fewer boxes on higher timeframes).
2. Order Block Identification
Order Blocks mark where institutions accumulated or distributed positions:
// Bullish Order Block
// Two consecutive bearish candles + strong bullish candle with high volume
bullishOB = close < open and
close < open and
close > open and
volume > volumeMA * 1.5
obHigh = high
obLow = low
// Bearish Order Block
// Two consecutive bullish candles + strong bearish candle with high volume
bearishOB = close > open and
close > open and
close < open and
volume > volumeMA * 1.5
Order Block characteristics:
Last opposite-direction move before strong impulse
Represents institutional accumulation (bullish OB) or distribution (bearish OB)
Often provides support/resistance on retests
Volume confirmation ensures institutional participation
Stronger OBs have larger candles and higher volume
The indicator draws solid boxes for Order Blocks and tracks their strength based on volume and candle size. Timeframe-adaptive filtering ensures only significant OBs are displayed.
3. Breaker Block Detection
Breaker Blocks are failed Order Blocks that signal potential reversals:
// Track last bullish and bearish Order Block levels
var float lastBullOBHigh = na
var float lastBearOBLow = na
if bullishOB
lastBullOBHigh := high
if bearishOB
lastBearOBLow := low
// Breaker Bull: Price breaks above failed bearish OB
breakerBull = not na(lastBearOBLow) and
close > lastBearOBLow and
close <= lastBearOBLow
// Breaker Bear: Price breaks below failed bullish OB
breakerBear = not na(lastBullOBHigh) and
close < lastBullOBHigh and
close >= lastBullOBHigh
Breaker Block significance:
Failed Order Blocks often become strong support/resistance in opposite direction
Indicate institutional position reversal
High-probability reversal zones when combined with other SMC signals
Often mark major trend changes
The indicator marks Breaker Blocks with "BB" labels and tracks them as potential reversal zones.
4. Liquidity Sweep Analysis
Liquidity Sweeps identify stop hunts before real moves:
lookbackBars = 20
// Recent highs and lows (liquidity pools)
recentHigh = ta.highest(high, lookbackBars)
recentLow = ta.lowest(low, lookbackBars)
// Liquidity Sweep High (stop hunt above recent high)
liquiditySweepHigh = high > recentHigh and
close < recentHigh and
volume > volumeMA * 1.5
// Liquidity Sweep Low (stop hunt below recent low)
liquiditySweepLow = low < recentLow and
close > recentLow and
volume > volumeMA * 1.5
// Strong sweeps have higher volume
strongSweep = volume > volumeMA * 2.5
Liquidity Sweep characteristics:
Price briefly exceeds recent high/low to trigger stops
Closes back inside range - "fake breakout"
High volume confirms institutional participation
Often precedes strong moves in opposite direction
"Strong" sweeps (very high volume) are more reliable
The indicator places "LIQ" and "STRONG LIQ" labels precisely at sweep tips (above bars for high sweeps, below bars for low sweeps) with timeframe-adaptive spacing to prevent overlap.
5. Market Structure Analysis
Market structure tracks control shifts between buyers and sellers:
// Break of Structure (BOS)
// Price breaks beyond previous swing high/low in trend direction
bullishBOS = close > ta.highest(high , 20) and trend == bullish
bearishBOS = close < ta.lowest(low , 20) and trend == bearish
// Change of Character (CHoCH)
// Price breaks structure against trend - potential reversal
bullishCHoCH = close > ta.highest(high , 20) and trend == bearish
bearishCHoCH = close < ta.lowest(low , 20) and trend == bullish
Market Structure significance:
BOS confirms trend continuation
CHoCH signals potential trend reversal
Helps identify when institutional control shifts
Provides context for other SMC signals
The indicator marks BOS and CHoCH with labels and uses them to determine overall market bias.
6. Displacement Detection
Displacement identifies strong institutional moves:
atr = ta.atr(14)
// Displacement: Large candle (> 2x ATR) with climax volume
displacement = math.abs(close - open) > atr * 2 and
volume > volumeMA * 3.0
bullishDisplacement = displacement and close > open
bearishDisplacement = displacement and close < open
Displacement characteristics:
Very large candles relative to ATR
Climax volume (> 3x average)
Indicates strong institutional directional intent
Often creates FVGs
Signals potential trend acceleration
The indicator marks displacement with "DISP" labels and uses them to identify high-conviction institutional moves.
Example showing all SMC concepts: FVGs, Order Blocks, Breaker Blocks, and liquidity sweeps
Timeframe-Adaptive System
The indicator automatically adjusts based on timeframe to prevent clutter:
// Higher timeframes (2H+): Fewer boxes, larger minimum sizes
if timeframe >= 120 minutes:
maxFVGs = 12
maxOBs = 10
minFVGSize = 0.5%
minOBSize = 0.8%
labelSpacing = 15 bars
// Medium timeframes (1H): Moderate filtering
else if timeframe >= 60 minutes:
maxFVGs = 15
maxOBs = 12
minFVGSize = 0.4%
minOBSize = 0.6%
labelSpacing = 12 bars
// Lower timeframes (15M): More boxes, smaller minimum sizes
else:
maxFVGs = 20-25
maxOBs = 15-20
minFVGSize = 0.3%
minOBSize = 0.4%
labelSpacing = 8-10 bars
This ensures the indicator remains useful across all timeframes without overwhelming the chart.
SMC Confluence Dashboard
The dashboard (top-right position) displays:
Market Bias: Bullish/Bearish/Neutral based on structure
Active FVGs: Count of unfilled Fair Value Gaps
Active OBs: Count of untested Order Blocks
Recent Sweeps: Liquidity sweeps in last 50 bars
Structure: Last BOS or CHoCH type
Displacement: Recent displacement direction
SMC Score: Overall confluence (0-10)
SMC Score calculation:
SMC Score Components:
- Significant FVG present: +2 points
- Strong Order Block present: +2 points
- Breaker Block active: +1 point
- Recent liquidity sweep: +2 points
- Displacement in direction: +3 points
Total: 0-10 points
Visual Elements
FVG Boxes: Green (bullish) and red (bearish) boxes, removed when mitigated
Order Block Boxes: Solid green/red boxes with strength-based transparency
Breaker Block Labels: "BB" markers at breaker zones
Liquidity Sweep Labels: "LIQ" and "STRONG LIQ" at sweep tips
Displacement Labels: "DISP" markers on displacement candles
Structure Labels: "BOS" and "CHoCH" at structure breaks
Mitigation Markers: Small circles when FVGs get filled
Dashboard: Top-right table with SMC metrics
How Components Work Together
The mashup reveals institutional trading sequences:
Sequence 1 - Accumulation:
1. Liquidity Sweep triggers retail stops
2. Order Block forms as institutions accumulate
3. Displacement occurs as institutions push price
4. FVG created during fast move
5. BOS confirms trend direction
Sequence 2 - Reversal:
1. Multiple liquidity sweeps fail to extend trend
2. Order Block fails, becomes Breaker Block
3. CHoCH signals control shift
4. Opposite-direction displacement
5. New trend structure forms
Example: Price sweeps below recent lows (liquidity sweep), then strongly reverses with high volume (displacement), leaving a bullish FVG. A bullish Order Block forms at the reversal zone. Price breaks above previous structure (BOS). SMC Score reaches 9/10, signaling strong bullish institutional setup.
Input Parameters
FVG Settings:
Show FVGs: Toggle FVG boxes (default: enabled)
Min FVG Size: Minimum gap size % (default: 0.3%)
Max FVG Boxes: Limit displayed boxes (default: timeframe-adaptive)
Show Mitigation: Mark when FVGs get filled (default: enabled)
Order Block Settings:
Show Order Blocks: Toggle OB boxes (default: enabled)
Min OB Strength: Minimum volume multiplier (default: 1.5x)
Max OB Boxes: Limit displayed boxes (default: timeframe-adaptive)
OB Lookback: Bars to track OBs (default: 100)
Liquidity Settings:
Show Liquidity Sweeps: Toggle sweep labels (default: enabled)
Lookback Bars: Period for liquidity pools (default: 20)
Strong Sweep Threshold: Volume multiplier (default: 2.5x)
Label Spacing: Minimum bars between labels (default: timeframe-adaptive)
Structure Settings:
Show Structure: Toggle BOS/CHoCH labels (default: enabled)
Show Breaker Blocks: Toggle BB labels (default: enabled)
Show Displacement: Toggle DISP labels (default: enabled)
Structure Sensitivity: Swing detection period (default: 20)
Display Options:
Show Dashboard: Toggle SMC dashboard (default: enabled)
Timeframe Adaptive: Auto-adjust limits (default: enabled)
Remove Extensions: Don't extend boxes right (default: enabled)
Color Theme: Choose color scheme
How to Use This Indicator
Step 1: Identify Market Structure
Check for recent BOS or CHoCH. BOS suggests trend continuation, CHoCH suggests potential reversal.
Step 2: Look for Liquidity Sweeps
Liquidity sweeps often precede strong moves in opposite direction. "STRONG LIQ" sweeps are particularly significant.
Step 3: Identify Order Blocks
Look for Order Blocks in the direction of intended trade. OBs often provide high-probability entry zones on retests.
Step 4: Check for FVGs
Unfilled FVGs act as magnets - price often returns to fill them. Can be used for entry targets or profit-taking zones.
Step 5: Watch for Displacement
Displacement signals strong institutional intent. When displacement occurs from an Order Block, it confirms the zone's validity.
Step 6: Monitor Breaker Blocks
Failed Order Blocks (Breaker Blocks) often mark major reversals. These are high-probability reversal zones.
Step 7: Review SMC Score
Check dashboard SMC Score. Scores above 7 indicate strong institutional confluence.
Best Practices
Use on 15-minute to 4-hour timeframes for optimal SMC signal quality
Liquidity sweeps followed by displacement are extremely high-probability setups
Order Block retests with FVG confluence provide excellent risk:reward entries
Wait for price to return to Order Blocks rather than chasing displacement
Multiple unfilled FVGs in same direction suggest strong institutional intent
Breaker Blocks combined with CHoCH signal major trend reversals
Higher timeframe SMC signals are more reliable than lower timeframe
Use SMC Score as filter - focus on setups with 7+ score
Combine with traditional support/resistance for additional confirmation
Indicator Limitations
Not all FVGs get filled - some remain unfilled in strong trends
Order Blocks don't always provide support/resistance on retest
Liquidity sweeps can be followed by additional sweeps (multiple stop hunts)
Timeframe-adaptive filtering may hide some valid signals
Requires understanding of Smart Money Concepts for effective use
Visual elements can clutter chart even with adaptive limits
SMC concepts work best in trending markets, less effective in ranges
Institutional behavior patterns can change over time
No SMC system eliminates false signals entirely
Technical Implementation
Built with Pine Script v6 using:
Box management system with automatic cleanup
Timeframe-adaptive limits and filtering
Anti-overlap logic for all labels with dynamic spacing
FVG mitigation tracking with visual markers
Order Block strength calculation based on volume and size
Liquidity pool identification with sweep detection
Market structure tracking with BOS/CHoCH logic
Displacement detection using ATR and volume
Real-time SMC confluence scoring
Comprehensive dashboard with all SMC metrics
The code is fully open-source and can be modified to adjust thresholds, visual preferences, and filtering criteria.
Originality Statement
This indicator is original in its comprehensive SMC integration approach. While individual concepts (FVG, Order Blocks, Breaker Blocks, Liquidity Sweeps, Market Structure, Displacement) are established Smart Money Concepts, this mashup is justified because:
It tracks all major SMC concepts simultaneously in one indicator
Timeframe-adaptive system prevents clutter while maintaining functionality
Anti-overlap logic ensures clean visual presentation
SMC confluence scoring quantifies institutional setup quality
Integration reveals complete institutional trading sequences
Enhanced visual elements (precise label positioning, mitigation markers) improve usability
Each SMC concept reveals different institutional behavior: FVGs show fast moves, Order Blocks show accumulation, Breaker Blocks show failed accumulation, Liquidity Sweeps show stop hunts, Market Structure shows control shifts, and Displacement shows strong intent. The mashup's value lies in presenting these complementary institutional footprints simultaneously, allowing traders to identify complete institutional trading sequences rather than isolated signals.
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice or a recommendation to buy or sell any financial instrument. Trading involves substantial risk of loss and is not suitable for all investors.
Smart Money Concepts are analytical frameworks based on observations of institutional trading patterns. They do not guarantee that institutions are actually trading at identified zones, nor do they predict future institutional behavior. Market conditions change, and patterns that worked historically may not work in the future.
The SMC Score is a mathematical calculation based on current market structure, not a prediction of future price movement. High SMC scores do not ensure profitable trades. Order Blocks, FVGs, and other SMC zones can fail to provide support/resistance. Liquidity sweeps can be followed by additional sweeps.
Always use proper risk management, including stop losses and position sizing appropriate for your account size and risk tolerance. Never risk more than you can afford to lose. Consider consulting with a qualified financial advisor before making investment decisions.
The author is not responsible for any losses incurred from using this indicator. Users assume full responsibility for all trading decisions made using this tool.
-Made with passion by officialjackofalltrades Indicator

Diamond V5 : Institutional SMC & Liquidity EngineDiamond V5: Ultimate Institutional SMC & Liquidity Engine
Diamond V5 is a high-precision trading framework designed for professional traders who follow SMC (Smart Money Concepts) and ICT methodologies. Unlike standard indicators, Diamond V5 is a complete structural engine that identifies where liquidity is resting and how institutional players are moving the market.
🚀 Key Features:
Auto-Market Detection: Smart algorithms that automatically adjust parameters (Sweep tolerance, confirmations) based on whether you are trading Gold, Forex, or Indices.
Advanced Structure Engine: Real-time mapping of BOS (Break of Structure) and CHoCH (Change of Character) with body-close confirmation.
Liquidity Clustering: Detects Equal Highs/Lows (EQH/EQL) with dynamic tolerance, identifying high-probability liquidity pools.
PD Array Filter: Integrated Premium/Discount logic to ensure you only Buy in Discount and Sell in Premium zones.
Institutional Confirmation: Combined Displacement, Fair Value Gaps (FVG), and Volume Spikes to filter out fakeouts.
Pro Dashboard: A comprehensive HUD showing HTF Trend, LTF Structure, Pricing status, and Killzone activity at a glance.
🛠 How to Trade (The Strategy):
Context: Ensure HTF Trend and Internal Structure are aligned (Green/Red Dashboard).
Setup: Wait for a Liquidity Sweep (Orange Diamond) in a Premium/Discount zone.
Trigger: Look for the BUY/SELL label which appears after a displacement candle creates a new FVG.
Target: Aim for the "Weak High/Low" target lines or use the dynamic 1:2 RR TP line.
📈 Optimized For:
Forex: EURUSD, GBPUSD, USDJPY (15m/1h)
Indices: NAS100, US30, SPX500 (1m/5m - NY Killzone)
Commodities: XAUUSD / GOLD (5m/15m)
توضیحات فارسی:
اندیکاتور Diamond V5 یک موتور معاملاتی پیشرفته مبتنی بر سبک اسمارت مانی (SMC) است. این ابزار با شناسایی خودکار ساختار بازار (BOS/CHoCH) و شکار نقدینگی (Liquidity Sweeps)، دقیقترین نقاط ورود در جهت روند اصلی را نمایش میدهد.
ویژگیهای برتر:
تشخیص خودکار نوع بازار (فارکس، طلا، شاخصها).
فیلتر قیمت منصفانه (ترید فقط در نواحی ارزان یا گران).
شناسایی نقدینگیهای مجتمع (Equal Highs/Lows).
ترسیم خودکار باکسهای FVG برای تایید ورود پول هوشمند.
داشبورد مدیریتی کامل برای بررسی همزمانی چندین فاکتور تحلیلی. Indicator

Protected Swings [LuxAlgo]The Protected Swings indicator identifies and confirms high-probability structural levels based on the interaction between liquidity sweeps, Fair Value Gaps (FVG), and Change in State of Delivery (CISD) logic. This tool aims to highlight "protected" highs and lows that are expected to remain intact during trend continuations or market reversals.
🔶 USAGE
The Protected Swings tool is designed to provide clear invalidation levels for stop placement and to help traders avoid false reversals by waiting for candle-body confirmation through specific price series.
🔹 Trend Reversals
A reversal setup occurs when the market sweeps a major liquidity level (such as a previous swing high or low) or taps into a high-timeframe FVG.
A Protected Swing High (PSH) forms after a sweep of a high followed by a close below the opening price of the up-close candle series that created that high. This suggests a shift to a bearish regime.
A Protected Swing Low (PSL) forms after a sweep of a low followed by a close above the opening price of the down-close candle series that created that low. This suggests a shift to a bullish regime.
🔹 Trend Continuation
Once Protected Swings are established, subsequent "stepping stones" often form. In a bearish trend, new PSHs will form as price wicks into internal FVGs and then closes back below the candle series that created the retracement high. These levels serve as trailing stop-loss points or areas to look for refined lower-timeframe entries.
🔹 Entry Refinement
Traders can use Protected Swings to refine Risk:Reward. When a higher-timeframe protected level is confirmed, users can drop to a lower timeframe and wait for a secondary protected swing to form. The "Confirmation Level" shown by the indicator represents the exact price point that must be breached to validate the "protected" status of that swing.
🔶 DETAILS
The script follows a multi-step logic to confirm Protected Swings:
🔹 Liquidity Sweeps
The indicator tracks structural pivots (Fractals) based on the "Sweep Sensitivity" setting. A sweep is detected only when the price wick exceeds a previous pivot high or low, but the candle body remains within the previous extreme. This "wick-only" break suggests liquidity is being grabbed (Stop Run) rather than a displacement break of structure occurring.
🔹 FVG Mitigations
The script detects Fair Value Gaps (3-candle imbalances). If enabled, a swing point is considered a candidate for a Protected Swing if it trades into an active FVG, even if a liquidity sweep of a major pivot did not occur.
🔹 Change in State of Delivery (CISD)
The core confirmation logic (CISD) requires the price to close through the "series."
For a Bullish Protected Swing , the script identifies the series of consecutive down-close candles leading into the low. The opening price of the first candle in that down-series becomes the Confirmation Level.
For a Bearish Protected Swing , it identifies the consecutive up-close candles. The opening price of the first candle in that up-series becomes the level.
The labels (PSL/PSH) only appear once a candle body closes past this level, ensuring the "State of Delivery" has shifted.
🔶 SETTINGS
🔹 Logic Settings
Sweep Sensitivity: Defines the number of bars required on both sides to confirm a structural pivot level to be used for detecting sweeps.
Include FVG Mitigations: When enabled, swings that tap into imbalances can trigger protected swing labels.
FVG Search Lookback: Determines how many bars back the script searches for active imbalances to use as context.
🔹 Visualization
Show Labels: Toggles the PSL (Protected Swing Low) and PSH (Protected Swing High) labels.
Show Confirmation Levels: Displays the horizontal lines representing the candle series opening price that triggered the confirmation.
Show Fair Value Gaps: Visualizes active imbalances on the chart.
Highlight Liquidity Sweeps: Highlights the specific portion of the wick that exceeded the previous structural pivot.
Colors: Customization for bullish and bearish elements and transparency for zones.
Indicator

Smart Money Concepts AI - AdaptiveSmart Money Concepts AI scores every Fair Value Gap and Order Block with a 5-factor quality engine so you can instantly see which zones are worth trading and which are noise.
◈ How It Works
This indicator detects three core Smart Money / ICT concepts and layers an AI scoring system on top.
Market Structure tracks swing highs and lows to identify Break of Structure (BOS) and Change of Character (CHoCH). BOS means the trend is continuing. CHoCH means it may be reversing. The indicator automatically classifies each break and draws labeled lines on your chart. CHoCH lines are solid and thicker since they're the more significant events. BOS lines are dashed. Both can be toggled independently.
Fair Value Gaps (FVGs) are 3-candle imbalances where price moved so fast it left a gap. The indicator detects these automatically and draws scored boxes on the chart. Each FVG gets a quality score from 0 to 100. Higher-scored zones appear more vivid; lower-scored zones fade out. When price fills the gap (mitigation), the box turns dashed.
Order Blocks (OBs) are the last opposite candle before a structural break. They represent institutional accumulation or distribution. When a bullish CHoCH/BOS fires, the indicator looks back for the last bearish candle near the swing low and marks it as a demand zone. Bearish OBs work in reverse. Each OB is scored by displacement strength, volume, and trend alignment.
◈ The AI Scoring Engine
Every zone gets a 0-100 quality score based on 5 factors:
For FVGs:
Gap Size vs ATR: sweet spot is 0.3x to 1.5x ATR. Too small = noise, too big = likely fills fast
Displacement Strength: body-to-range ratio of the middle candle. Full-body candles = institutional conviction
Volume: displacement candle volume vs 20-period average
Trend Alignment: does the FVG direction match the EMA trend?
Structure Alignment: does it align with the current BOS/CHoCH direction?
For Order Blocks:
OB Size: tighter zones (0.3-1.0 ATR) score higher for precision
Post-OB Displacement: how far price moved after leaving the OB. Bigger moves = stronger institutional interest
Volume, Trend, and Structure: same alignment checks as FVGs
The score directly controls visual opacity. High-scoring zones are vivid and prominent, low-scoring zones are subtle and transparent. You can filter to "High Only" to hide zones scoring below 50.
◈ Signals
Signals fire when price enters a scored FVG zone with structural and trend alignment. If a scored Order Block overlaps the FVG, the score increases further.
★ Bright signals = high confluence (score ≥ 70 default). FVG + OB overlap + structure + trend all confirm.
○ Dim signals = moderate confluence (score ≥ 50). The setup exists but not all factors align perfectly.
By default, only ★ bright signals are shown to keep the chart clean. You can enable dim signals in settings if you want to see every zone touch. A configurable cooldown (default 10 bars) prevents signal spam.
All signals are non-repainting. They only appear on confirmed bar closes.
◈ How to Read the Dashboard
SMC AI ◈: header
Structure: current direction (▲ BULLISH / ▼ BEARISH / — RANGING) with bias label
Trend(50): whether the EMA trend agrees with structure (✓ ALIGNED = go / ✗ COUNTER = caution)
Best FVG: quality score of the highest-rated active FVG in the current direction, with visual bar
Best OB: quality score of the highest-rated active Order Block, with visual bar
Signal: last signal state (★ LONG / ○ SHORT / — WAITING) with the actual entry score
Zones: count of active bull/bear FVGs and OBs on chart
The Signal row shows the actual score from when the signal fired, so it always matches the label on the chart.
◈ Recommended Settings
Forex (EUR/USD, GBP/JPY) 1H to 4H: Swing Length 5, ATR 14, Trend EMA 50, Signal Cooldown 10
Forex scalping 15min: Swing Length 3, ATR 10, Trend EMA 34, Signal Cooldown 5
Crypto (BTC, ETH) 1H to 4H: Swing Length 5, ATR 14, Trend EMA 50, Signal Cooldown 10
Gold / Commodities 4H to Daily: Swing Length 7, ATR 14, Trend EMA 50, Signal Cooldown 15
Indices (NAS100, SPX500) 15min to 1H: Swing Length 3 to 5, ATR 10, Trend EMA 34, Signal Cooldown 8
For aggressive setups: Lower Min Signal Score to 40, enable dim signals, show more FVGs (8 to 10)
For conservative setups: Raise Min Signal Score to 70, filter FVGs to "High Only", increase cooldown
◈ Key Features
✓ Non-repainting: all signals confirmed on bar close
✓ AI zone scoring: 5-factor quality engine, 0-100 per zone
✓ Visual hierarchy: opacity reflects score, you instantly see what matters
✓ Mitigation tracking: filled FVGs and broken OBs fade automatically
✓ Rich tooltips: hover any signal for full breakdown
✓ 9 alert conditions: BOS, CHoCH, bull/bear signals, AI-confirmed signals
✓ Signal clutter control: cooldown + dim toggle keeps charts clean
✓ Fully customizable: colors, zone counts, thresholds, all adjustable
✓ 100% original code: not derived from any existing script
◈ What This Is NOT
This is not a "paint arrows and win" indicator. SMC/ICT trading requires understanding context. Where is structure pointing? Which zones are institutionally significant? Is the trend aligned? This indicator helps you answer those questions faster by scoring every zone objectively.
Always use proper risk management. Past performance does not guarantee future results.
Happy trading. Indicator

Dynamic Delta FVG [LuxAlgo]The Dynamic Delta FVG indicator provides a comprehensive analysis of Fair Value Gaps (FVGs) by integrating intra-bar volume delta to visualize the internal buying and selling pressure within price imbalances.
🔶 USAGE
The script identifies standard Fair Value Gaps and enhances them by splitting the visual representation into two distinct segments based on volume delta. This allows traders to see exactly where institutional aggressive orders were concentrated during the formation of the gap.
Users can utilize this tool to:
Identify high-probability FVGs where the volume delta aligns with the gap direction. Determine specific price levels within a gap that acted as the primary "point of control" for buyers or sellers. Monitor real-time sentiment through a dynamic dashboard that aggregates the delta of all active imbalances. Filter out insignificant market noise using ATR and volume-based threshold settings.
🔹 Detailed Buyer/Seller Tags
Each active FVG features a dynamic tag on the right edge displaying the specific percentage of buying (B) and selling (S) volume that occurred within that price range. The tag background color shifts based on the dominant force, providing an immediate visual cue of the gap's internal strength. These tags move dynamically as the boxes expand, ensuring they always remain at the current price action edge.
🔹 Filter Overlapping
When enabled, the script will automatically remove existing active FVGs that overlap with a new discovery. This ensures only the most recent "current" imbalance is displayed in a specific price zone, preventing visual clutter and focusing on the most relevant institutional levels.
🔹 Mitigation Modes
The script supports two mitigation modes to suit different trading styles:
**Touch:** A gap is considered mitigated as soon as price enters the range. **Full Fill:** A gap remains active until price has completely traversed the entire range of the imbalance.
🔶 DETAILS
The indicator utilizes
request.security_lower_tf()
to fetch granular volume data from lower timeframes (e.g., 1-second data). This allows for a precise calculation of "Buy Volume" versus "Sell Volume". The split in the FVG box represents the ratio of these volumes. For example, if an FVG has 70% buying volume, the green segment will occupy 70% of the vertical height of the box, while the red segment occupies the remaining 30%.
🔹 Aggregate Sentiment Dashboard
The dashboard calculates market strength across all active imbalances rather than just categorizing by gap direction. This means if multiple bullish FVGs contain significant "absorbed" selling volume, the "Seller Strength" metric will accurately reflect this bearish pressure. The Net Sentiment is derived from the net difference between aggregate buyer and seller percentages across all active gaps.
🔶 SETTINGS
🔹 Detection Filters
**Min Volume Threshold:** Multiplier for the 20-period average volume. Gaps forming on volume lower than this threshold are ignored. **Min ATR Magnitude:** Sets the minimum required size of the FVG relative to the current ATR. **Mitigation Mode:** Determines whether a touch or a full fill "closes" the gap. **Filter Overlapping:** When enabled, the script deletes older active gaps that overlap with new ones.
🔹 Volume Delta Analysis
**Delta Timeframe:** The lower timeframe used for volume calculations. Required for higher precision on 1m charts.
🔹 Visuals
**Max Active Gaps:** Limits the number of boxes displayed on the chart (Default: 10). **Buyer/Seller Color:** Customizable colors for the split segments within the FVG. **Show Mitigated Gaps:** When enabled, mitigated gaps remain on the chart with a faded appearance.
🔹 Dashboard
**Show Dashboard:** Toggles the real-time sentiment and imbalance summary table. **Position/Size:** Controls the UI placement and scale of the dashboard. Indicator

[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
Indicator

Indicator
