Precision Edge System [JOAT]Precision Edge System
Introduction
The Precision Edge System is an advanced open-source multi-timeframe trading strategy that combines Opening Range Breakout, Fair Value Gap detection, Break of Structure analysis, Order Block identification, Fibonacci confluence, volatility regime classification, multi-oscillator divergence, RSI-2 mean reversion, and adaptive risk management into a unified institutional-grade trading system. This strategy helps traders capture high-probability setups by requiring multiple independent confirmation signals before entering trades, significantly reducing false signals and improving win rates.
Unlike basic strategies that rely on single indicators, this system uses a confluence scoring approach where each component contributes points toward entry decisions. Opening Range provides context, Fair Value Gaps provide entry zones, Market Structure confirms direction, Order Blocks show institutional positioning, Fibonacci shows harmonic levels, Regime Detection filters conditions, Divergence warns of reversals, and RSI-2 catches pullbacks. The strategy is designed for traders who understand that the best setups occur when multiple institutional concepts align simultaneously.
Why This Strategy Exists
This strategy addresses the fundamental challenge of trading: most single-indicator strategies produce too many false signals or miss too many opportunities. By combining multiple institutional concepts with flexible confluence requirements, this strategy reveals:
Opening Range Breakout: First 30 minutes establish institutional positioning - breakouts signal directional commitment
Fair Value Gap Retests: Price imbalances that get filled - optimal entry zones with defined risk
Break of Structure: Swing high/low breaks confirm trend direction and momentum
Order Blocks: Last opposing candle before strong moves - institutional accumulation/distribution zones
Premium/Discount Arrays: Value context showing whether price is expensive or cheap
Fibonacci Confluence: Golden Pocket and multi-wave alignment for reversal zones
Volatility Regime Detection: Trending/Ranging/Choppy classification to avoid bad conditions
Multi-Oscillator Divergence: RSI/MACD/Stochastic divergence for reversal signals
RSI-2 Mean Reversion: Extreme oversold/overbought in trends for pullback entries
Session-Based Timing: London/New York kill zones for highest liquidity
Adaptive Risk Management: Dynamic stop loss, take profit, and trailing stops based on volatility
Each component provides independent confirmation. The strategy's power comes from requiring multiple components to align before entering trades, creating high-probability setups with favorable risk-reward ratios.
Core Strategy Components
1. Opening Range Breakout (ORB) System
The Opening Range is established during the first 30 minutes of the trading session (9:30-10:00 AM by default):
// Track high/low during OR session
if inOR:
orHigh = max(high, orHigh)
orLow = min(low, orLow)
// Detect breakouts after OR established
orBreakoutUp = close > orHigh and close <= orHigh
orBreakoutDown = close < orLow and close >= orLow
Opening Range logic:
First 30 minutes = institutions establish positions
OR High/Low define the day's initial range
Breakouts above OR High = bullish bias
Breakouts below OR Low = bearish bias
OR levels used as stop loss reference points
The strategy can operate in two modes:
Breakout Required: Only trades after OR breakout (more selective)
Flexible: Trades inside OR if other confluence is strong (more frequent)
ORB contributes 2 points to confluence score when breakout occurs.
2. Fair Value Gap (FVG) Entry System
Fair Value Gaps are three-candle price imbalances that often get filled:
// Bullish FVG: Current low > 2 candles ago high
bullishFVG = low > high
fvgBullTop = low
fvgBullBottom = high
// Entry on retest
fvgBullRetest = low <= fvgBullTop and close >= fvgBullBottom
FVG entry logic:
Identifies imbalance zones where price moved too fast
Waits for price to return to the gap (retest)
Enters at gap high (bullish) or gap low (bearish)
Provides precise entry with tight stop below/above gap
FVG retest contributes 2 points to confluence score. The strategy tracks active FVGs and removes them when filled.
3. Market Structure (BOS/CHoCH) Confirmation
Break of Structure confirms trend direction:
// Detect swing highs/lows
swingPivotHigh = ta.pivothigh(high, 5, 5)
swingPivotLow = ta.pivotlow(low, 5, 5)
// BOS: Price breaks swing in trend direction
if swingPivotHigh > lastSwingHigh and bullishStructure:
bosOccurred = true // Bullish BOS
Structure logic:
Tracks swing highs and lows using pivot detection
BOS = break in trend direction (continuation)
CHoCH = break against trend (potential reversal)
Internal structure shows nested patterns for timing
The strategy can operate in two modes:
BOS Required: Only trades after structure break (more selective)
Flexible: Trades without BOS if other confluence is strong (more frequent)
BOS contributes 2 points to confluence score when it occurs.
4. Order Block Detection and Mitigation
Order Blocks mark institutional positioning zones:
// Bullish OB: Last bearish candle before strong bullish move
bullishOB = close < open and close > open and
(high - low) > atr * 1.2 and
volume > avgVol * 1.1
Order Block logic:
Identifies last opposing candle before momentum shift
Requires volume and ATR confirmation
Strength classification (Strong = 4+ points, Normal = 2-3 points)
Tracks active blocks until mitigated (price closes through)
Active Order Blocks contribute 1 point to confluence score. Strong Order Blocks (high volume + high ATR) contribute an additional 1 point.
5. Premium/Discount Array Context
Premium/Discount Arrays show value context:
rangeHigh = ta.highest(high, 50)
rangeLow = ta.lowest(low, 50)
rangeEQ = (rangeHigh + rangeLow) / 2
inPremium = close > rangeEQ and close > (rangeEQ + (rangeHigh - rangeEQ) * 0.5)
inDiscount = close < rangeEQ and close < (rangeEQ - (rangeEQ - rangeLow) * 0.5)
Value Array logic:
Calculates 50-period range high/low
Equilibrium = 50% level (fair value)
Premium = upper 50% of range (expensive)
Discount = lower 50% of range (cheap)
Institutional bias: Buy discount, sell premium
Being in discount zone contributes 1 point to long confluence. Being in premium zone contributes 1 point to short confluence.
6. Fibonacci Confluence and Golden Pocket
Fibonacci analysis identifies harmonic reversal zones:
// Calculate Fibonacci levels from swing
fib618 = swingLow + (swingHigh - swingLow) * 0.618
fib650 = fib618 * 1.052
// Golden Pocket = 0.618 to 0.65 zone
inGoldenZone = close >= min(fib618, fib650) and close <= max(fib618, fib650)
Fibonacci logic:
Calculates Fibonacci retracements from multiple swing lengths
Golden Pocket (0.618-0.65) = highest probability reversal zone
Extensions (1.272, 1.414, 1.618) used for profit targets
Confluence zones where multiple Fib levels align
Being in Golden Pocket contributes 1 point to both long and short confluence (reversal zone).
7. Volatility Regime Filter
Regime detection classifies market conditions:
atr = ta.atr(14)
atrSma = ta.sma(atr, 50)
volRatio = atr / atrSma
// Trending: EMAs aligned + normal volatility
trendStrength = (ema9 > ema21 and ema21 > ema50) or
(ema9 < ema21 and ema21 < ema50)
regime = volRatio > 1.5 ? 0 : // Choppy
trendStrength ? 2 : // Trending
1 // Ranging
Regime logic:
Trending (2): Directional market, use breakout strategies
Ranging (1): Oscillating market, use mean reversion
Choppy (0): Erratic market, avoid trading
The strategy can operate in two modes:
Avoid Choppy: No trades in choppy regime (more selective)
Trade All: Trades in all regimes if confluence is strong (more frequent)
Regime filter prevents trading in unfavorable conditions.
8. Multi-Oscillator Divergence Detection
Divergence analysis identifies momentum exhaustion:
// Bullish divergence: Price LL, RSI HL
if pricePivotLow < lastPriceLow and rsiPivotLow > lastRsiLow:
bullish_divergence = true
Divergence logic:
Regular divergence = potential reversal signal
Hidden divergence = trend continuation signal
Requires extreme zones (RSI >70 or <30) for best setups
Multi-oscillator confluence increases reliability
Bullish divergence contributes 2 points to long confluence. Bearish divergence contributes 2 points to short confluence.
9. RSI-2 Mean Reversion System
RSI-2 catches extreme pullbacks in trends:
rsi2 = ta.rsi(close, 2)
ema200 = ta.ema(close, 200)
// Long: RSI-2 oversold in uptrend
rsi2_oversold = rsi2 < 10 and close > ema200
// Short: RSI-2 overbought in downtrend
rsi2_overbought = rsi2 > 90 and close < ema200
RSI-2 logic:
2-period RSI is extremely sensitive to pullbacks
Oversold (<10) in uptrend = buy the dip
Overbought (>90) in downtrend = sell the rally
Requires 200 EMA trend filter for context
RSI-2 signals contribute 2 points to confluence score.
10. Candlestick Pattern Recognition
The strategy detects reversal patterns:
Hammer: Long lower wick, small body, bullish reversal
Shooting Star: Long upper wick, small body, bearish reversal
Bullish Engulfing: Bullish candle engulfs previous bearish candle
Bearish Engulfing: Bearish candle engulfs previous bullish candle
Morning Star: Three-candle bullish reversal pattern
Evening Star: Three-candle bearish reversal pattern
Strong patterns (with volume confirmation) contribute 2 points to confluence score.
11. Session-Based Timing (Kill Zones)
The strategy focuses on high-liquidity sessions:
London Session: 2:00-5:00 AM EST (default)
New York Session: 8:30-11:00 AM EST (default)
Silver Bullet: 9:00-10:00 AM EST (default)
Session logic:
Highest volume and volatility during these periods
Institutional participation is strongest
Better follow-through on breakouts
Can be disabled for 24-hour trading
Confluence Scoring System
The strategy uses a point-based confluence system where each component contributes points:
Long Confluence Points:
OR Breakout Up: +2 points
BOS Bullish: +2 points
FVG Bull Retest: +2 points
Active Bullish OB: +1 point
Strong Bullish OB: +1 point (bonus)
In Discount Zone: +1 point
In Golden Pocket: +1 point
RSI-2 Oversold: +2 points
Bullish Divergence: +2 points
Liquidity Below: +1 point
Volume Spike: +1 point
Bullish Momentum: +1 point
Bullish Pattern: +2 points
Entry Modes (Configurable):
Strict Mode: Requires 8+ points (very selective, highest quality)
Moderate Mode: Requires 6+ points (balanced approach)
Flexible Mode: Requires 4+ points (more frequent trades)
Aggressive Mode: Requires 3+ points (highest frequency)
This flexible system allows traders to adjust trade frequency based on their preference and market conditions.
Risk Management System
1. Stop Loss Placement:
The strategy uses intelligent stop loss placement:
OR-Based Stops: If OR is active, stop = OR Low (long) or OR High (short)
ATR-Based Stops: If no OR, stop = Entry ± (2 × ATR)
Structure-Based Stops: Can use swing lows/highs for stops
2. Position Sizing:
Risk-based position sizing:
accountRisk = strategy.equity * (riskPercent / 100) // Default 1%
riskPerShare = entry - stopLoss
positionSize = accountRisk / riskPerShare
This ensures consistent risk per trade regardless of stop distance.
3. Take Profit Targets:
Adaptive take profit based on volatility:
// Base reward multiple (default 2R)
tpMultiplier = rewardMultiple
// Increase in high volatility
if volatility_high:
tpMultiplier = rewardMultiple * 1.5
takeProfit = entry + (riskPerShare * tpMultiplier)
Default 2R target (2x risk) provides favorable risk-reward. High volatility increases target to 3R.
4. Trailing Stop System:
Adaptive trailing stop activates after profit threshold:
Activates after 1R profit (default)
Trails at breakeven + 0.5R
Locks in profits while allowing trend to run
Adjusts trail distance based on ATR
5. Time-Based Exits:
End-of-day exit prevents overnight risk:
Closes all positions at 3:55 PM EST (default)
Prevents gap risk and overnight exposure
Can be disabled for swing trading
6. Daily Trade Limit:
Maximum trades per day prevents overtrading:
Default: 10 trades per day maximum
Resets at start of each trading day
Prevents revenge trading and overexposure
Strategy Performance Metrics
The strategy displays real-time performance in the dashboard:
Confluence Scores: Current long/short confluence (0-20 scale)
OR Status: Active/Forming
Structure: Bullish/Bearish
BOS Signal: Confirmed/Pending
Regime: Trending/Ranging/Choppy
Value Zone: Premium/Discount/Equilibrium
RSI State: Overbought/Oversold/Neutral
Volatility: High/Normal/Low
Volume: Spike/High/Dry/Normal
Position: Long/Short/Flat
Net P/L: Current profit/loss
Win Rate: Percentage of winning trades
Total Trades: Number of closed trades
Profit Factor: Gross profit / Gross loss
Input Parameters
Trade Frequency:
Entry Mode: Strict/Moderate/Flexible/Aggressive
Min Confluence Score: 1-10 (lower = more trades)
Allow Partial Setups: Trade with 2/3 conditions met
Opening Range:
OR Session: Time range for OR (default 9:30-10:00)
ORB Filter: Enable/disable OR requirement
Fibonacci Extensions: Show extension levels
Breakout Required: Must break OR to trade
Market Structure:
Fractal Period: Swing detection length (default 5)
Require BOS/CHoCH: Must have structure break
Multi-TF Confluence: Check higher timeframe
Internal Structure: Show nested patterns
Order Blocks:
OB Filter: Enable/disable OB requirement
Volatility Threshold: ATR multiplier (default 1.2)
Volume Threshold: Volume multiplier (default 1.1)
Block Quality: All/Strong/Extreme
Fair Value Gaps:
FVG Entry: Enable/disable FVG entries
Min Imbalance: Percentage threshold (default 0.2%)
Zone Quality: All/Strong/Extreme
Auto-Fill Detection: Remove filled gaps
Risk Management:
Risk Per Trade: Percentage of equity (default 1%)
Reward Multiple: R multiple for TP (default 2.0)
Adaptive Take Profit: Adjust TP for volatility
EOD Exit: Close positions at end of day
Adaptive Trailing Stop: Enable trailing stops
Trail Activation: R multiple to activate (default 1.0)
Max Daily Trades: Limit trades per day (default 10)
How to Use This Strategy
Step 1: Configure Entry Mode
Choose entry mode based on desired trade frequency. Strict = fewer high-quality trades. Flexible = more frequent trades. Start with Moderate.
Step 2: Set Risk Parameters
Configure risk per trade (1% recommended), reward multiple (2R recommended), and position sizing. Never risk more than you can afford to lose.
Step 3: Enable Desired Components
Turn on/off components based on your trading style. All components enabled = most selective. Fewer components = more frequent trades.
Step 4: Monitor Dashboard
Watch confluence scores in real-time. Long score >6 = potential long setup. Short score >6 = potential short setup. Higher scores = better setups.
Step 5: Review Entry Labels
When strategy enters, it displays label with entry price, stop loss, take profit, and confluence score. Review to understand why trade was taken.
Step 6: Let Strategy Manage Exits
Strategy handles stop loss, take profit, trailing stops, and EOD exits automatically. Don't interfere with exits unless necessary.
Step 7: Analyze Performance
Review dashboard metrics regularly. Win rate >50%, profit factor >1.5, and positive net P/L indicate good performance.
Best Practices
Start with Moderate mode and adjust based on results
Higher confluence scores = higher win rates but fewer trades
Backtest thoroughly before live trading
Use realistic commission (0.075%) and slippage
Respect regime filter - avoid choppy markets
Session filter improves quality - trade kill zones
EOD exit prevents overnight risk for day traders
Daily trade limit prevents overtrading
Monitor dashboard for real-time confluence
Adjust parameters for different instruments and timeframes
Strategy Limitations
Confluence system can miss trades when components don't align
Multiple filters reduce trade frequency significantly
Backtesting results may not reflect live performance
Slippage and commission impact profitability
News events can invalidate technical setups
Regime detection may lag at transitions
Opening Range less reliable on low-volume days
Fair Value Gaps may not fill immediately
Order Blocks can fail in strong trends
Divergences can persist before reversing
The strategy shows high-probability setups, not guaranteed winners
Technical Implementation
Built with Pine Script v6 using:
Opening Range tracking with session detection
Fair Value Gap detection and retest monitoring
Market structure analysis with BOS/CHoCH detection
Order Block identification with strength classification
Premium/Discount Array calculations
Fibonacci confluence and Golden Pocket detection
Volatility regime classification system
Multi-oscillator divergence detection
RSI-2 mean reversion signals
Candlestick pattern recognition
Session-based timing filters
Confluence scoring algorithm
Adaptive risk management system
Real-time performance dashboard
The code is fully open-source and can be modified to suit individual trading styles and preferences.
Originality Statement
This strategy is original in its comprehensive institutional integration approach. While individual components (ORB, FVG, BOS, OB, Fibonacci, RSI, MACD) are established concepts, this strategy is justified because:
It synthesizes 11 distinct institutional concepts into unified confluence scoring system
The flexible entry mode system allows traders to adjust selectivity vs frequency
Adaptive risk management adjusts stops and targets based on volatility
Multi-component confluence significantly reduces false signals vs single-indicator strategies
Session-based timing focuses on high-liquidity periods for better execution
Regime filter prevents trading in unfavorable market conditions
Candlestick pattern integration adds reversal confirmation layer
Real-time dashboard presents 15 metrics simultaneously for complete strategy visibility
The strategy combines trend-following (BOS, ORB) with mean-reversion (RSI-2, Divergence) for versatility
Each component contributes independent confirmation: ORB shows context, FVG shows entry, BOS shows direction, OB shows positioning, Arrays show value, Fibonacci shows harmonics, Regime shows conditions, Divergence shows exhaustion, RSI-2 shows pullbacks, Patterns show reversals, and Sessions show timing. The strategy's value lies in requiring multiple components to align before entering trades, creating high-probability setups with favorable risk-reward ratios.
Disclaimer
This strategy 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.
Past performance does not guarantee future results. Backtesting results are hypothetical and may not reflect actual trading performance. Actual results will vary due to slippage, commission, market conditions, and execution differences. The strategy may experience periods of drawdown and losing trades.
High confluence scores do not guarantee profitable trades. Market conditions change, and strategies that worked historically may not work in the future. News events, market shocks, and fundamental factors can override technical setups.
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 strategy. Users assume full responsibility for all trading decisions made using this tool.
Recommended Settings for Backtesting
Initial Capital: $10,000 (realistic for average trader)
Commission: 0.075% per trade (realistic for most brokers)
Slippage: 1-2 ticks (depends on instrument liquidity)
Risk Per Trade: 1% of equity
Reward Multiple: 2R (2:1 risk-reward)
Entry Mode: Moderate (6+ confluence)
Timeframe: 5-minute or 15-minute chart
Instruments: Liquid stocks, forex majors, or major crypto
Sample Size: Minimum 100 trades for statistical significance
-Made with passion by officialjackofalltrades Strategy

Indicator

Indicator

Indicator

Structural Flow Decoder [JOAT]Structural Flow Decoder
Introduction
The Structural Flow Decoder is an advanced open-source market structure analysis indicator that combines Break of Structure (BOS) detection, Change of Character (CHoCH) identification, nested pattern recognition, and multi-timeframe confluence into a unified structural analysis system. This indicator helps traders identify trend direction, structural shifts, and momentum changes by analyzing how price breaks through swing highs and lows across multiple timeframes.
Unlike basic trend indicators that use moving averages, this system analyzes actual market structure - the sequence of higher highs, higher lows, lower highs, and lower lows that define trends. Break of Structure signals trend continuation, Change of Character signals potential reversals, nested patterns reveal internal structure, and multi-timeframe alignment confirms institutional conviction. The indicator is designed for traders who understand that market structure precedes price and that structural breaks reveal directional intent.
Why This Indicator Exists
This indicator addresses a critical need in technical analysis: the ability to identify trend changes before they're obvious. Market structure analysis reveals when institutions are shifting positioning. By combining multiple structural methodologies, this indicator reveals:
Break of Structure (BOS): Price breaks swing high/low in trend direction - confirms continuation and momentum
Change of Character (CHoCH): Price breaks swing high/low against trend - signals potential reversal or consolidation
Nested Structure: Internal patterns within larger structure - reveals micro-trends and entry timing
Multi-Timeframe Confluence: Higher timeframe structure alignment - confirms institutional participation
Momentum Shifts: RSI and MACD crossovers at structure breaks - adds confirmation layer
Trend Strength Analysis: Quantifies structural conviction - distinguishes strong from weak trends
Each component provides a different lens on market structure. BOS shows continuation, CHoCH shows reversals, nested structure shows timing, MTF alignment shows conviction, and momentum shows acceleration. Together, they create a comprehensive view of structural flow.
Core Components Explained
1. Break of Structure (BOS) Detection
Break of Structure occurs when price breaks a swing high in an uptrend or swing low in a downtrend. It confirms trend continuation:
// Bullish BOS: Price breaks above previous swing high
if pivotHigh > lastSwingHigh and bullishStructure:
line.new(lastSwingHighBar, lastSwingHigh, bar_index, pivotHigh,
color=COLOR_BULL_STRUCTURE, width=3, style=line.style_solid)
label.new(bar_index, pivotHigh, "BOS ↑")
The indicator identifies BOS using swing detection:
Detects swing highs and lows using pivot lookback (default 5 periods)
Compares current swing to previous swing in same direction
Draws solid lines connecting swings when BOS occurs
Labels breaks with "BOS ↑" or "BOS ↓" for clarity
BOS signals that the trend is intact and institutions are pushing price in the established direction. Multiple consecutive BOS indicate strong trending conditions.
2. Change of Character (CHoCH) Detection
Change of Character occurs when price breaks a swing high in a downtrend or swing low in an uptrend. It signals potential trend reversal:
// Bullish CHoCH: Price breaks above swing high while in downtrend
if pivotHigh > lastSwingHigh and not bullishStructure:
line.new(lastSwingHighBar, lastSwingHigh, bar_index, pivotHigh,
color=COLOR_CHOCH_BULL, width=3, style=line.style_dashed)
label.new(bar_index, pivotHigh, "CHoCH ↑")
bullishStructure := true
CHoCH is more significant than BOS because it represents structural shift:
Breaks counter-trend swing points
Signals potential trend reversal or major consolidation
Drawn with dashed lines to distinguish from BOS
Flips internal trend state when detected
CHoCH doesn't guarantee reversal, but it warns that the previous trend is weakening. Confirmation from other factors (volume, momentum, higher timeframe) increases reliability.
3. Nested Structure Analysis
Nested structure reveals internal patterns within the larger trend. It uses shorter lookback periods to detect micro-structure:
The indicator tracks internal swings using a separate period (default 3 bars vs 5 for main structure). This reveals:
Internal BOS within larger trends - shows momentum acceleration
Internal CHoCH before main CHoCH - early warning of reversals
Pullback structure in trends - identifies entry opportunities
Consolidation patterns - shows when to wait
Nested structure is drawn with thinner dashed lines to distinguish from main structure. It provides entry timing within the larger trend context.
4. Multi-Timeframe Confluence
The indicator requests structure data from a higher timeframe (default 60-minute) and compares it to current timeframe:
= request.security(syminfo.tickerid, "60",
)
Multi-timeframe analysis reveals:
Whether current timeframe structure aligns with higher timeframe
Institutional conviction (HTF structure = larger positions)
Confluence zones where both timeframes show same direction
Divergence warnings when timeframes conflict
The dashboard displays HTF alignment status (Bullish/Bearish) and confluence state (Synced/Divergent). Trading in direction of HTF structure with current timeframe confirmation produces highest win rates.
5. Momentum Shift Detection
The indicator integrates RSI and MACD to detect momentum shifts at structural breaks:
rsi = ta.rsi(close, 14)
= ta.macd(close, 12, 26, 9)
momentum_bull = ta.crossover(rsi, 50) and macdHist > 0
momentum_bear = ta.crossunder(rsi, 50) and macdHist < 0
Momentum shifts are marked with "M+" (bullish) or "M-" (bearish) labels. When momentum shifts align with structural breaks, it confirms the move. Momentum divergence from structure warns of potential failures.
6. Trend Strength Classification
The indicator quantifies trend strength based on consecutive structural breaks:
Explosive: 3+ consecutive BOS in same direction
Active: 1-2 consecutive BOS
Weak: No recent BOS or mixed signals
Strength classification appears in the dashboard and influences background gradient intensity. Strong trends show vibrant colors, weak trends show muted colors.
Visual Elements
BOS Lines: Solid thick lines (cyan for bullish, magenta for bearish)
CHoCH Lines: Dashed thick lines (cyan for bullish, magenta for bearish)
Internal Structure: Thin dashed lines showing nested patterns
Swing Point Labels: "H" and "L" markers at pivot highs/lows
Momentum Labels: "M+" and "M-" at momentum shifts
Gradient Background: Color intensity based on trend strength
Gradient Candles: Strong moves in bright colors, weak moves in muted colors
Dashboard: Real-time structure state and confluence metrics
The dashboard displays 8 key metrics:
1. Structure Flow (Bullish/Bearish)
2. Flow Strength (Explosive/Active/Weak)
3. HTF Alignment (Bullish/Bearish/Off)
4. Confluence (Synced/Divergent)
5. Momentum (Strong/Neutral/Weak)
6. MACD Signal (Bullish/Bearish)
7. Last Pivot price level
Input Parameters
Structure Analysis:
Detection Period: Swing lookback for main structure (default: 5)
Break of Structure: Enable/disable BOS detection
Change of Character: Enable/disable CHoCH detection
Nested Patterns: Enable/disable internal structure
Nested Period: Swing lookback for internal structure (default: 3)
Momentum Shifts: Enable/disable RSI/MACD labels
Higher Timeframe:
Multi-Timeframe Sync: Enable/disable HTF analysis
HTF Period: Higher timeframe to analyze (default: 60 minutes)
Confluence Filter: Require HTF alignment for signals
Visualization:
Directional Zones: Show gradient backgrounds
Pivot Markers: Show H/L labels at swings
Strength Histogram: Show trend strength bars
How to Use This Indicator
Step 1: Identify Current Structure
Check the dashboard for Structure Flow. Bullish structure = look for longs, Bearish structure = look for shorts. This is your directional bias.
Step 2: Wait for Structural Confirmation
In bullish structure, wait for BOS (break above swing high) to confirm continuation. In bearish structure, wait for BOS (break below swing low). Don't trade against structure.
Step 3: Watch for Change of Character
CHoCH signals potential reversal. When CHoCH occurs, structure flips. Wait for confirmation BOS in new direction before entering. Don't trade immediately on CHoCH.
Step 4: Use Nested Structure for Timing
Internal structure shows pullback completion. Enter when internal BOS occurs in direction of main structure. This provides precise entry timing.
Step 5: Confirm with Higher Timeframe
Check HTF Alignment in dashboard. "Synced" = both timeframes agree (best setups). "Divergent" = conflict (avoid or reduce size).
Step 6: Add Momentum Confirmation
Look for M+ labels in bullish structure or M- labels in bearish structure. Momentum + Structure = highest probability setups.
Best Practices
Trade in direction of structure - don't fight it
BOS confirms trend, CHoCH warns of change - respect both
Multiple BOS in same direction = strong trend, ride it
CHoCH requires confirmation - don't reverse immediately
Nested structure provides entries within larger trend
HTF alignment is critical - always check confluence
Momentum divergence from structure = warning sign
Explosive strength = trending conditions, use breakout strategies
Weak strength = ranging conditions, use mean reversion
Structure works on all timeframes - scale appropriately
Indicator Limitations
Structure analysis works best on trending markets with clear swings
Choppy, sideways markets produce frequent false CHoCH signals
Swing detection requires sufficient volatility - low volatility reduces reliability
CHoCH doesn't guarantee reversal - it signals potential change
Multiple CHoCH in short period indicates consolidation, not trend
HTF data may repaint on lower timeframes - use confirmed bars
Nested structure can be noisy in ranging markets
The indicator shows structure state, not future direction
Momentum shifts can occur without structural confirmation
Technical Implementation
Built with Pine Script v6 using:
Pivot-based swing detection with configurable lookback
State machine tracking for bullish/bearish structure
Nested structure analysis with separate period
Multi-timeframe security requests with proper gap handling
RSI and MACD momentum calculations
Trend strength quantification system
Dynamic gradient backgrounds based on strength
Real-time dashboard with 8 structural metrics
The code is fully open-source and can be modified to suit individual trading styles and preferences.
Originality Statement
This indicator is original in its comprehensive structural integration approach. While individual components (BOS, CHoCH, swing detection) are established concepts, this indicator is justified because:
It synthesizes BOS and CHoCH detection with nested pattern analysis in a unified system
The multi-timeframe confluence detection provides institutional conviction measurement
Momentum shift integration (RSI + MACD) adds confirmation layer to structural breaks
Trend strength quantification distinguishes explosive from weak structural flows
Nested structure analysis reveals micro-patterns within macro-trends for entry timing
The gradient visualization system shows structural conviction through color intensity
Real-time dashboard presents 8 metrics simultaneously for holistic structural analysis
Each component contributes unique information: BOS shows continuation, CHoCH shows reversals, nested structure shows timing, HTF shows conviction, momentum shows acceleration, and strength shows quality. The indicator's value lies in presenting these complementary perspectives simultaneously with unified classification and visual hierarchy.
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.
Market structure analysis is a tool for understanding price behavior, not a crystal ball for predicting future movement. BOS does not guarantee continuation. CHoCH does not guarantee reversal. Past structural patterns do not guarantee future structural patterns. Market conditions change, and strategies that worked historically may not work in the future.
The structural states displayed are analytical constructs based on current market data, not predictions of future price movement. Structure alignment does not guarantee profitable trades. Users must conduct their own analysis and risk assessment before making trading decisions.
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

Fibonacci Structure Engine [WillyAlgoTrader]📐 Fibonacci Structure Engine is an overlay indicator that combines automatic Fibonacci retracement from live market structure with Smart Money Concepts (BOS/CHoCH detection), weighted confluence scoring, premium/discount zone classification, and context-filtered engulfing pattern entries — creating a complete structure-to-Fibonacci-to-entry workflow where every component feeds into the next.
The core idea: Fibonacci levels are only meaningful when drawn from the correct swing points. This indicator automates the entire process: it detects swing highs/lows with ATR-filtered pivot detection, identifies structure breaks (BOS) and trend reversals (CHoCH), anchors Fibonacci retracement levels from the structure-defined swing, trails the live edge as price extends, locks it when a confirmed pivot arrives, scores the confluence between current price and Fibonacci levels, and generates entry signals when engulfing patterns occur at high-confluence zones in the correct structural context.
Most Fibonacci tools on PulseWire require manual drawing — you select the swing high and low, and the levels appear. The problem: selecting the wrong swing, forgetting to update after a new structure break, or drawing from a minor swing that doesn't reflect the current trend leg. This indicator solves all three: the Fibonacci anchors update automatically on every structure break, trail the live edge as price extends, and lock when a confirmed pivot arrives — always reflecting the most relevant swing for the current market structure.
🧩 WHY THESE COMPONENTS WORK TOGETHER
Fibonacci retracement levels alone are static S/R lines. Structure detection alone tells you trend direction. Engulfing patterns alone fire everywhere. Confluence scoring alone has nothing to score against.
This indicator chains them into a dependency pipeline:
ATR-filtered swing detection → HH/HL/LH/LL classification → BOS/CHoCH structure breaks → Fibonacci anchor from structure swing → Live edge trailing + pivot locking → Fib level calculation → Confluence scoring (price vs Fib levels) → Premium/Discount zone classification → Engulfing pattern detection in structural context → Entry signal with cooldown
The swing detection feeds the structure engine — without confirmed pivots, no BOS/CHoCH can fire. The structure breaks anchor the Fibonacci levels — without a break, there's no swing to draw from. The Fibonacci levels feed the confluence scorer — without levels, there's nothing to score proximity against. The confluence score plus the premium/discount zone filter the engulfing patterns — without context, engulfing patterns produce too many false entries. And the signal cooldown prevents clustering from this entire chain.
Removing the structure detection breaks the Fibonacci anchoring. Removing the ATR filter floods the structure with noise swings. Removing the confluence scoring allows entries at non-Fibonacci prices. Removing the premium/discount filter allows bullish entries in premium (where sells should occur). Each component eliminates a specific failure mode.
🔍 WHAT MAKES IT ORIGINAL
1️⃣ Structure-anchored Fibonacci with live edge trailing.
The Fibonacci engine uses a 4-phase lifecycle:
Phase 1 — Anchor on structure break: When a BOS or CHoCH is detected:
— Bullish break: top = current high (live, will trail), bottom = most recent swing low (locked)
— Bearish break: bottom = current low (live, will trail), top = most recent swing high (locked)
This instantly draws Fibonacci levels from the break point.
Phase 2 — Trail live edge: As price extends beyond the initial break, the live edge (top for bull, bottom for bear) updates to the new extreme. Fibonacci levels recalculate continuously to reflect the current move. This captures the full extent of the breakout without waiting for a pivot confirmation.
Phase 3 — Lock on pivot: When a confirmed swing high (for bullish trailing) or swing low (for bearish trailing) is detected by the pivot engine, the live edge locks to that confirmed pivot. The Fibonacci levels stop updating and represent the confirmed swing range.
Phase 4 — Update on new swings: When a new confirmed swing arrives that differs from the current locked anchor, the Fibonacci levels update to the new structure — always reflecting the most recent confirmed swing.
This lifecycle means the Fibonacci levels are always relevant: immediately reactive after a break (phases 1–2), then structurally confirmed once a pivot is detected (phases 3–4).
2️⃣ ATR-filtered pivot detection with noise suppression.
Standard ta.pivothigh/ta.pivotlow detects every local extreme, including minor fluctuations that don't represent real swing points. The ATR filter requires:
— For a swing high: the distance from the pivot high to the most recent swing low ≥ ATR × multiplier (default 0.5)
— For a swing low: the distance from the most recent swing high to the pivot low ≥ ATR × multiplier
This ensures only swings of meaningful size (relative to current volatility) are used for structure detection and Fibonacci anchoring. The multiplier is configurable: lower (0.2–0.3) for more granular structure, higher (0.8–1.0) for only major swings.
3️⃣ BOS / CHoCH structure detection with bias tracking.
The indicator tracks a persistent structureBias variable (+1 bullish, −1 bearish, 0 neutral):
— BOS (Break of Structure) : close breaks above the most recent swing high while bias is already bullish (or below swing low while already bearish) — trend continuation
— CHoCH (Change of Character) : close breaks above swing high while bias was bearish, or below swing low while bias was bullish — trend reversal
Each break requires: barstate.isconfirmed + the swing level hasn't been broken before (tracked via lastBrokenHigh/lastBrokenLow). Structure lines are drawn from the swing point to the break bar with configurable style (solid/dashed/dotted) and width.
4️⃣ Weighted confluence scoring (0–100).
The indicator measures how close the current price is to each Fibonacci level (within ATR × tolerance) and assigns weights by Fib importance:
— 0.236 → weight 1.0 (minor level)
— 0.382 → weight 1.5 (shallow retracement)
— 0.500 → weight 2.0 (equilibrium)
— 0.618 → weight 2.5 (golden ratio — highest weight)
— 0.786 → weight 1.5 (deep retracement)
Swing highs/lows within tolerance add +1.0 each. Total weight × 10 = confluence score (capped at 100). Classification: Strong (≥ 60), Moderate (≥ 30), Weak (> 0), None (0).
The tolerance is ATR-based (default 0.3× ATR) — on a volatile instrument, the "near" zone expands proportionally. On a quiet instrument, it tightens. This prevents false confluence readings from both too-tight and too-loose proximity checks.
5️⃣ Premium / Discount zone classification.
Using the 0.500 Fibonacci level as the equilibrium:
— Premium : close > Fib 0.500 — price is above equilibrium (expensive relative to the swing)
— Discount : close ≤ Fib 0.500 — price is below equilibrium (cheap relative to the swing)
This classification is used as a context filter for engulfing patterns: bullish engulfing patterns are only marked when price is in discount or at a confluence zone. Bearish engulfing patterns are only marked in premium or at a confluence zone. This prevents the most common engulfing failure mode: bullish patterns at the top of a range and bearish patterns at the bottom.
6️⃣ Context-filtered engulfing pattern detection.
The engulfing pattern detection requires:
— Current candle body > EMA(body, 14) — above-average body size (not a doji)
— Previous candle body < EMA(body, 14) — smaller previous candle (setup for engulf)
— Current candle fully engulfs previous candle's body
— Context filter: in premium/discount zone OR confluence weight ≥ 1.5
Bearish engulfing (▼): marked when price is in premium or near a Fib level — a reversal pattern at resistance. Bullish engulfing (▲): marked when price is in discount or near a Fib level — a reversal pattern at support.
7️⃣ Dual-path entry signals with cooldown.
Two entry paths:
— Engulfing + Structure + Confluence : engulfing pattern in context + structure bias aligned + confluence weight ≥ 1.5
— CHoCH (trend reversal) : any confirmed CHoCH — strong reversal signal, no additional confluence required
Both paths subject to signal cooldown (default 5 bars) to prevent clustering. Buy/Sell signals are displayed as labels (off by default — enable in Visual Settings).
8️⃣ Golden Zone + Target Zone visualization.
Two highlighted zones drawn as semi-transparent boxes:
— Golden Zone (0.500 – 0.786): the highest-probability retracement area. Where most retests find support/resistance.
— Target Zone (−0.500 – −0.618): the Fibonacci extension target for the next leg. Where price typically reaches after a confirmed retracement entry.
Both zones extend rightward by the configurable extension (default 20 bars) and update with Fibonacci level changes.
9️⃣ Seven configurable Fibonacci levels.
Individually toggleable: 0.236, 0.382, 0.500, 0.618, 0.786, −0.500, and Target (−0.618). Each drawn with distinct line styles — 0.618 is the thickest and most opaque (golden ratio emphasis), 0.236 is the thinnest (minor level). A dotted reference line connects the swing low to swing high showing the measured move.
⚙️ HOW IT WORKS — CALCULATION FLOW
Step 1 — Pivot detection: ta.pivothigh/ta.pivotlow with configurable lookback. ATR filter removes minor swings (swing size must exceed ATR × multiplier).
Step 2 — Swing tracking: Most recent two swing highs and two swing lows stored with bar indices. Each new swing is compared to previous → HH/HL/LH/LL classification.
Step 3 — Structure detection: Close breaks above swing high → BOS (if bias already bullish) or CHoCH (if bias was bearish). Same logic inverted for bearish breaks. Structure bias updated.
Step 4 — Fibonacci anchoring: On break → live edge set at current extreme, locked edge at swing. Live edge trails with price. Locks when confirmed pivot arrives. Updates on new swings.
Step 5 — Level calculation: fibLevel = swingHigh − (swingHigh − swingLow) × ratio for each ratio. Extension targets use negative ratios.
Step 6 — Confluence scoring: For each Fib level, check if |close − level| ≤ ATR × tolerance. Add weighted score. Include swing level proximity. Cap at 100.
Step 7 — Entry logic: Path A: engulfing in context + bias + confluence ≥ 1.5. Path B: CHoCH. Both respect cooldown.
📖 HOW TO USE
🎯 Quick start:
1. Add the indicator — Fibonacci levels and structure labels appear automatically
2. HH/HL/LH/LL labels show market structure
3. BOS/CHoCH labels show structure breaks and reversals
4. Yellow-shaded Golden Zone (0.500–0.786) = highest-probability retracement area
5. ▲/▼ arrows = engulfing patterns in structural context
6. Enable Buy/Sell Signals in Visual Settings for entry labels
👁️ Reading the chart:
— 🟢 HH / HL labels = bullish structure (higher highs, higher lows)
— 🔴 LH / LL labels = bearish structure (lower highs, lower lows)
— 🟢 "BOS" line + label = bullish break of structure (continuation)
— 🔴 "BOS" line + label = bearish break of structure
— 🟢🔴 "CHoCH" = Change of Character (trend reversal)
— 🔵 Horizontal lines = Fibonacci levels (0.236–0.786)
— 🟡 Shaded box (upper) = Golden Zone (0.500–0.786)
— 🟡 Shaded box (lower) = Target Zone (−0.500 to −0.618)
— 🟢 ▲ = bullish engulfing in discount / Fib zone
— 🔴 ▼ = bearish engulfing in premium / Fib zone
— 🟢 "BUY" / 🔴 "SELL" = confirmed entry signals (when enabled)
🔧 Tuning guide:
— Too many structure labels: increase Swing Length (12–20) or increase ATR Multiplier (0.7–1.0)
— Missing swings: decrease Swing Length (5–8) or decrease ATR Multiplier (0.2–0.3)
— Confluence too strict: increase Confluence ATR Tolerance (0.4–0.5)
— Too many engulfing signals: they self-filter by premium/discount — increase ATR Filter to reduce swing count
— Signal clustering: increase Signal Cooldown (8–15 bars)
⚙️ KEY SETTINGS REFERENCE
⚙️ Main:
— Swing Detection Length (default 10): pivot lookback — higher = larger swings
— ATR Swing Filter (default On): minimum swing size as ATR multiple
— ATR Filter Multiplier (default 0.5): how large swings must be
— Signal Cooldown (default 5): bars between consecutive signals
📐 Fibonacci:
— Show Fibonacci Levels (default On)
— Fib Extension Bars (default 20): rightward line extension
— Individual level toggles : 0.236 (off), 0.382, 0.500, 0.618, 0.786, −0.5, Target −0.618
— Confluence ATR Tolerance (default 0.3): proximity threshold
🏗️ Structure:
— BOS / CHoCH (default On): show structure break lines and labels
— Swing Labels (default On): HH/HL/LH/LL on pivots
— Engulfing Signals (default On): context-filtered patterns
🎨 Visual:
— Buy/Sell Signals (default Off): enable for entry labels
— Structure line style (Solid/Dashed/Dotted) and width (1–4)
— Auto / Dark / Light theme
🔔 Alerts
— 🟢 BUY / 🔴 SELL — ticker, price, TF, confluence score, SL, TP
— 🔵 BOS — structure break with direction
— 🟡 CHoCH — trend reversal with direction
All support plain text and JSON webhook format. Bar-close confirmed.
⚠️ IMPORTANT NOTES
— 🚫 No repainting. All structure breaks and signals require barstate.isconfirmed. Pivot detection uses equal left/right lookback (swingLen/swingLen) — pivots are confirmed swingLen bars after the actual high/low. Fibonacci levels update on confirmed pivots and structure breaks only.
— 📐 The Fibonacci anchor system has two states per edge: live and locked . A live edge trails with price (capturing the full move after a break). A locked edge is confirmed by a pivot. You'll see the Fibonacci levels shift on bar close as the live edge updates — this is by design, not repainting. Once the pivot locks, levels stabilize.
— ⚖️ The 0.618 level carries the highest confluence weight (2.5) because it is the golden ratio — the most statistically significant Fibonacci retracement level. The 0.500 carries weight 2.0, while the extreme levels (0.236, 0.786) carry 1.0–1.5.
— 📊 Buy/Sell signals are off by default . The indicator is designed primarily as a structure + Fibonacci analysis tool. Enable signals in Visual Settings when you want automated entry detection.
— 🔄 CHoCH signals do not require confluence — they represent a structural trend reversal, which is inherently a high-conviction event. Engulfing-based entries require confluence weight ≥ 1.5 + correct structural bias.
— 📏 The Golden Zone (0.500–0.786) is the area where most successful retests occur . The Target Zone (−0.500 to −0.618) is the area where the next impulse leg typically reaches. Both are highlighted with semi-transparent boxes.
— 🛠️ This is a structure analysis and Fibonacci visualization tool , not an automated trading bot. It maps market structure, draws Fibonacci levels, scores confluence, and identifies high-probability entry zones — trade decisions remain yours.
— 🌐 Works on all markets and timeframes. Indicator

MTF-Auto-Triad SMT Engine [TradeSymmetry]MTF-Auto-Triad SMT Engine
This indicator puts institutional order flow front and center, featuring an automated Multi-Timeframe (MTF) liquidity divergence engine as its core, supported by built-in helper tools for higher timeframe market structure and momentum tracking.
Built to eliminate chart clutter while maximizing actionable data, this tool is engineered for traders executing high-probability, asymmetric setups on intraday execution timeframes.
🔥 Core Feature: The SMT Engine
Stop manually typing in comparison tickers every time you switch assets. The Auto-Triad system instantly detects the asset class you are viewing and automatically scans correlated markets for Smart Money Tool (SMT) divergences across multiple timeframes simultaneously.
Supported Triads: * Indices: NQ1!, ES1!, YM1!
Forex: EURUSD, GBPUSD, DXY
Metals: XAGUSD, XAUEUR, XAUGBP, GC1!
Oil: CL1!, RB1!, HO1!
🛠 Built-In Helper Tools
1. Dynamic HTF Boxes with Time stamping
Keep your higher timeframe narrative locked in while executing on the LTF.
Live-Tracking OHLC: Project custom Higher Timeframe boxes (e.g., 1H, 4H, Daily) directly onto your execution chart.
Open Time Anchors: The Open level of your HTF box automatically pulls the exact timestamp of when that session began (e.g., 09:30 4H-OPEN), giving you crucial temporal context right at the point of execution.
2. Time-Price Velocity (TPV) Candles
Traditional candlesticks only show price action. The TPV engine colors your candles based on mathematically smoothed, ATR-normalized momentum.
Identify exactly when momentum is accelerating or decelerating inside a move.
Built-in dashboard shows live velocity metrics, trend direction, and acceleration changes.
💡 How to Use This Tool (The TradeSymmetry Setup)
This indicator is built to execute a strict, structural trading workflow. Follow these core steps:
1. Identify Your POI & Wait for the Sweep/Tap
Frame your narrative and identify your draw on liquidity. Wait patiently for price to sweep a key structural extreme (Session, Daily, Weekly, Monthly Highs/Lows, or Equal Highs/Lows). Alternatively, wait for price to tap into a high-probability Fair Value Gap (FVG) or Order Block (OB).
2. Confirm Institutional Footprints (SMT)
Once price reaches your POI, look for an SMT Divergence to print via the Auto-Triad engine. This confirms that correlated assets are failing to make the same high or low—the ultimate footprint of smart money accumulation or distribution.
3. Wait for the Shift & Open Level Validation
Look for a clear Market Structure Shift (MSS) or Change in State of Delivery (CISD).
Crucial Rule: If you are taking a bullish setup, ensure your trigger candle closes cleanly above the Open level. For a bearish setup, the candle must close cleanly below the Open level.
4. Execute the Trade
Once all criteria are met, use the momentum color shift in the TPV candles as your final entry trigger. Target asymmetric risk-to-reward setups (1:3 or 1:5 R:R) based on the next structural draw on liquidity.
⚙️ Customization
Everything is modular. Don't want the TPV colors? Turn them off. Want to use a custom 4-asset comparison instead of the Auto-Triads? Switch to Manual mode. Every line and label size can be custom-colored to fit your exact visual style.
Trade with symmetry. Indicator

ICT Swing Structure [STL/STH/ ITL/ITH /LTL/LTH]ICT Swing Structure
This indicator automatically identifies and labels the three degrees of market structure as taught in the ICT (Inner Circle Trader) 2022 Mentorship — Short-Term, Intermediate-Term, and Long-Term swing highs and lows.
Price swings are classified into a nested hierarchy:
STH / STL — Short-Term Highs and Lows, the most frequent pivots on any timeframe
ITH / ITL — Intermediate-Term Highs and Lows, formed when a short-term swing is confirmed by surrounding short-term pivots on both sides
LTH / LT L — Long-Term Highs and Lows, the most significant turning points requiring intermediate-term confirmation on both sides
Each degree is displayed with a distinct color-coded label and a horizontal reference line extending forward from the swing point. Line lengths are scaled to significance — ST levels extend the shortest distance, LT levels the longest — keeping the chart clean while highlighting what matters most.
Fully customizable with toggles for each degree, adjustable pivot sensitivity, and individual color controls for ST, IT, and LT levels.
Best used as part of a top-down analysis workflow to define HTF bias, identify liquidity pools, and frame precision entries across all asset classes and timeframes. Indicator

Phantom Flow Decoder [JOAT]Phantom Flow Decoder
Introduction
The Phantom Flow Decoder is an open-source overlay indicator that brings together five core Smart Money Concepts into a single, cohesive tool: market structure detection (BOS/CHoCH), order block identification, liquidity pool tracking with sweep and trap detection, Fair Value Gap (FVG) analysis with consequent encroachment, and premium/discount zone mapping. Rather than toggling between multiple scripts, traders can observe how these institutional concepts interact on the same chart in real time.
The indicator is built with Pine Script v6 and uses custom user-defined types to manage every structural element as a self-contained object, keeping the codebase modular and the chart clean even when all features are enabled simultaneously.
Why This Indicator Exists
Most Smart Money Concept tools on PulseWire focus on a single element, such as order blocks alone or FVGs alone. This forces traders to stack multiple concepts and mentally piece together the relationships between them. The Phantom Flow Decoder solves this by synthesizing these elements into one unified system where:
Structure breaks validate order blocks: An order block only forms when a confirmed pivot is detected, ensuring the OB has structural significance.
Liquidity pools are volume-weighted: Pools are not just swing points; they carry a volume weight that reflects how much participation occurred at that level.
FVGs are tracked through their lifecycle: From formation to mitigation, each gap is monitored and visually updated when price fills it.
Premium/discount zones provide context: Knowing whether price sits in the top 20% or bottom 20% of the recent range helps traders decide whether to look for longs or shorts.
Core Components Explained
1. Market Structure Detection (BOS and CHoCH)
The indicator uses pivot-based swing detection to identify Higher Highs (HH), Lower Lows (LL), Higher Lows (HL), and Lower Highs (LH). When price breaks a previous swing level, the script classifies it as either a Break of Structure (BOS), which continues the existing trend, or a Change of Character (CHoCH), which signals a potential trend reversal.
Structure strength is calculated by combining volume ratio and price movement relative to ATR. A BOS with high volume and a large price move relative to ATR is considered stronger than one with thin volume.
calcStructureStrength(float priceMove, float vol, float atrVal, float volSmaVal) =>
float volRatio = vol / volSmaVal
float priceRatio = priceMove / atrVal
math.min(100, (volRatio * 30 + priceRatio * 70))
Each structure break is drawn as a horizontal line extending from the break level, with a compact label ("BOS" or "CHoCH") positioned nearby. Line styles are configurable between solid, dashed, and dotted.
Overview showing BOS and CHoCH labels on the chart with structure lines extending from break points
2. Order Block Detection
Order blocks represent the last opposing candle before a significant move. The indicator identifies bullish order blocks as the last bearish candle before a swing low, and bearish order blocks as the last bullish candle before a swing high. To filter noise, order blocks must meet a minimum size threshold measured in ATR multiples (default 0.5x ATR).
Each order block is drawn as a semi-transparent box with a dashed equilibrium line at its midpoint. When price returns to an order block and penetrates through it, the block is marked as mitigated and its visual is removed from the chart, keeping the display uncluttered.
3. Liquidity Pool Detection with Sweeps and Traps
Liquidity pools form at swing points where stop orders are likely clustered. The indicator tracks these pools and monitors them for two key events:
Sweeps: When price briefly pierces a liquidity level and then reverses, the pool is marked with a gold "SWEEP" label. The sweep threshold is configurable in ATR multiples.
Traps: When a sweep occurs with abnormally high volume, it is classified as a Smart Money Trap and marked with a magenta "TRAP" label, suggesting institutional manipulation.
When volume-weighted liquidity is enabled, each pool carries a weight based on the volume at the swing point relative to the 20-period volume SMA. This helps traders prioritize pools where significant participation occurred.
4. Fair Value Gap (FVG) Analysis
A bullish FVG forms when the current bar's low is above the high from two bars ago, creating a gap in price delivery. A bearish FVG is the inverse. The indicator filters FVGs by a minimum size (default 0.3x ATR) to avoid plotting insignificant gaps.
Each FVG is drawn as a colored box. When Consequent Encroachment is enabled, a dashed line is drawn at the 50% level of the gap, which institutional traders often use as a precise entry point. FVGs are tracked for mitigation: when price fills the gap, the box style changes to indicate it has been mitigated. FVGs older than the configurable max age (default 50 bars) are automatically removed.
5. Premium/Discount Zones
Using a configurable lookback period (default 50 bars), the indicator calculates the highest high and lowest low, then divides the range into zones. The top 20% is the premium zone (where sellers have an edge), the bottom 20% is the discount zone (where buyers have an edge), and the 50% level is the equilibrium. These zones are drawn as semi-transparent boxes with an equilibrium line.
Visual Elements
Swing Point Labels: HH, HL, LH, LL labels at each confirmed pivot
Structure Lines: Horizontal lines at BOS/CHoCH levels with configurable styles
Order Block Boxes: Semi-transparent boxes with equilibrium midlines
Liquidity Pool Boxes: Thin boxes at swing levels with SWEEP/TRAP labels
FVG Zones: Colored boxes with optional CE (50%) lines
Premium/Discount Zones: Background shading for range context
Candle Coloring: Optional trend-based candle coloring
Dashboard: Real-time metrics including trend direction, structure counts, and sweep/trap counts
Input Parameters
Structure Detection:
Pivot Sensitivity (2-20, default 5): Lower values detect more pivots, higher values only detect stronger swings
Show BOS / Show CHoCH: Toggle each structure type independently
Structure Line Style: Solid, Dashed, or Dotted
Order Block Detection:
Order Block Strength (1-10, default 3): Minimum candles for valid OB
Track OB Mitigation: Automatically remove mitigated OBs
Min OB Size (ATR): Minimum order block size filter
Liquidity Detection:
Liquidity Sensitivity (1-10, default 3)
Sweep Threshold (ATR): How far price must pierce a level to count as a sweep
Volume-Weighted Liquidity: Weight pools by volume participation
Fair Value Gaps:
FVG Max Age (bars): Auto-remove old FVGs (default 50)
Track FVG Mitigation: Monitor and update filled gaps
Min FVG Size (ATR): Filter small gaps
Show Consequent Encroachment: Draw 50% midline
Premium/Discount Zones:
Zone Lookback (20-200, default 50)
Show Equilibrium Line
How to Use This Indicator
Step 1: Identify the current market structure by observing BOS/CHoCH labels. A series of bullish BOS confirms an uptrend; a bearish CHoCH warns of a potential reversal.
Step 2: Look for unmitigated order blocks in the direction of the trend. In an uptrend, focus on bullish OBs below current price as potential support zones.
Step 3: Check if any FVGs overlap with order blocks. This confluence of an institutional entry zone (OB) with an imbalance in price delivery (FVG) creates a high-probability area.
Step 4: Confirm the zone is in the discount area (for longs) or premium area (for shorts) using the premium/discount zones.
Step 5: Monitor liquidity pools for sweeps. A sweep of a liquidity pool followed by a reversal into a confluence zone is a classic institutional entry pattern.
Step 6: Use the dashboard to monitor overall market conditions and structure counts.
Example showing a confluence setup: FVG overlapping with an order block in the discount zone, with a nearby liquidity sweep
Indicator Limitations
Pivot detection has an inherent delay equal to the pivot lookback period. Structure labels appear after confirmation, not in real time.
Order blocks and FVGs are based on historical price patterns and do not predict future price movement.
Volume-weighted features work best on instruments with reliable volume data. Low-volume instruments may produce less meaningful liquidity weights.
The indicator draws many visual elements simultaneously. On lower timeframes with high bar counts, consider reducing the Max Structure Elements setting to maintain chart performance.
Premium/discount zones are relative to the lookback period. Changing the lookback significantly alters the zones.
Smart Money Concepts are interpretive frameworks, not guaranteed predictors. Always use proper risk management.
Originality Statement
This indicator is original in its unified integration approach. While individual SMC components (BOS, CHoCH, order blocks, FVGs, liquidity pools) exist in separate scripts, this indicator is justified because:
It combines five distinct SMC methodologies into a single, object-oriented system using Pine Script v6 user-defined types
Volume-weighted liquidity pool detection adds a quantitative dimension to traditional swing-based liquidity mapping
Smart Money Trap detection (high-volume sweeps) provides a layer of institutional activity analysis not found in standard liquidity tools
FVG lifecycle tracking with consequent encroachment gives traders precise institutional entry levels
The premium/discount zone overlay provides immediate context for whether a setup is in a favorable or unfavorable area of the range
All components share state and interact: structure breaks trigger order block creation, liquidity pools are validated against volume data, and FVGs are checked against premium/discount positioning
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 that help interpret market behavior, but they do not guarantee profitable trades. Past patterns do not guarantee future results. Always use proper risk management, including stop losses and position sizing appropriate for your account. The author is not responsible for any losses incurred from using this indicator.
-Made with passion by officialjackofalltrades
Indicator

Indicator

Indicator

Sessions + [Interakktive]Sessions + is a multi-layer session intelligence indicator that maps the trading day's structure across three analytical layers: institutional levels, ICT concepts, and real-time analytics. It combines session detection, a full hierarchy of reference levels from hourly to quarterly, killzone effectiveness grading, Power of 3 phase detection, CBDR expansion targets, a live VWAP-based DNA predictor, anomaly monitoring, and an adaptive plain-English dashboard into a single overlay.
The indicator works across all asset classes — crypto, forex, stocks, indices, and commodities — with automatic asset class detection that adjusts which sessions and analytics are relevant. On intraday timeframes it provides full session intelligence. On daily, weekly, and monthly charts it automatically pivots to showing institutional reference levels and an adaptive dashboard that tells you where price sits relative to yesterday, the weekly range, and the monthly structure. No competitor session indicator adapts across timeframes like this.
Sessions + is a context tool, not a signal generator. It does not issue buy or sell signals. It answers the question every session trader asks before placing a trade: "Where am I in the trading day, and is this session worth trading?" Like all technical analysis, it works best when combined with proper risk management and the trader's own judgment.
⚙️ **The Dashboard**
The dashboard synthesizes all active intelligence into a plain-English panel. Every row shows a narrative — not raw numbers. "Strong Bearish — Ranging" instead of "-0.45". "Range Exhausted" instead of "82%". "NY likely bullish" instead of "65% cont".
Six views control density: Off, Minimal (session + verdict), Status (adds killzone grades, timing, bias, ADR, activity), Trade (adds PO3, energy, projections), Analytics (adds DNA, flow, range, efficiency, anomalies), and Full (everything). Each progressive view includes the rows from previous views so context is never lost.
The verdict row combines directional bias with regime classification into a single answer: "Leaning Bullish — Trending", "No Clear Edge — Ranging", "Strong Bearish — Volatile". One glance, one decision.
*Dashboard in Full mode on BTCUSD 15m: plain-English intelligence across every row — verdict with regime, killzone grades (LDN:A, LC:A), PO3 phase, DNA live read, inter-session flow, anomaly detection with warning. Session boxes and VWAP provide chart context behind the panel.*
⚙️ **Levels Layer — Institutional Reference Lines**
Sessions + provides a complete hierarchy of institutional reference levels, each with visual weight that scales with timeframe importance:
Previous Hour High/Low (PHH/PHL) — dotted micro-levels for intraday scalping. Previous Day High/Low/Close (PDH/PDL/PDC) — the daily framework that institutional traders watch for liquidity grabs. Previous Week High/Low (PWH/PWL) — swing-level institutional references where weekly liquidity rests. Previous Month and Quarter High/Low (PMH/PML/PQH/PQL) — the heavyweight levels where hedge funds and central banks operate.
Additional level features include: ADR Projection Levels (expected daily high/low from the midnight open), Opening Range (the first N minutes' range as a breakout reference with a clearly filled box), Session VWAP (institutional volume-weighted benchmark per session), and Session Equilibrium (the 50% midpoint of each session's range — a magnet for retracements). Every level label includes a tooltip explaining why it matters and how to use it.
*Levels Layer on BTCUSD 15m: institutional levels from hourly through weekly — PDH, PDC, PWH (heavier line weight), ADR High/Low projections, Session Equilibrium (dashed), Opening Range, and VWAP line. Labels on the right edge show level names and prices. Visual weight increases with timeframe importance.*
⚙️ **ICT Layer — Killzones, Power of 3, and CBDR**
The ICT Layer implements key Inner Circle Trader concepts with intelligence features that go beyond static time boxes.
Killzones highlight four high-probability time windows (Asian, London Open, NY AM, London Close) with individual toggles and configurable times. Each killzone is graded A+ through D based on its historical reversal success rate and move quality on the specific instrument — a feature not found in other session indicators. Grades update as data accumulates, helping traders focus on the killzones that actually work for the asset they are trading.
Power of 3 Detection divides the selected session into three institutional phases — Accumulation (range building), Manipulation (false break), and Distribution (true directional move). Rather than floating labels above candles, the phases are shown as zones inside the session box with vertical dividers and phase names at the bottom, creating a clear visual narrative of how the session developed.
CBDR Projections (Central Bank Dealers Range) calculate the range formed during 20:00–00:00 UTC and project 1x and 2x expansion targets above and below. The 2x target is drawn with heavier line weight — this is where the real daily move often reaches.
Additional ICT features include Silver Bullet windows (AM and PM reversal windows), Macro Times (5-minute reversal windows at key NY times), Midnight Open (00:00 UTC true day open), and Weekly Open (Monday's opening price as a bias reference).
*ICT Layer on EURUSD 15m: CBDR expansion targets (cyan lines — 1x dashed, 2x solid), killzone backgrounds with effectiveness grades (London Open A, London Close C), Silver Bullet window (green), Midnight Open reference line, and PO3 Distribution label. Dashboard in Status view shows KZ Grades and Silver Bullet Grades.*
⚙️ **Analytics Layer — Session DNA, Flow, and Anomaly Detection**
The Analytics Layer provides intelligence features that help traders evaluate session quality in real time.
Session DNA is a live VWAP-based predictor that tracks where price sits relative to the session's Volume-Weighted Average Price. Each session gets a narrative box below it that builds as the session develops: "Bull" means price has stayed above VWAP, "Bear - Bull" means it started bearish then flipped bullish, "Bear - Neutral - Bull" tells a choppy reversal story. The narrative uses a 5-bar confirmation filter and caps at 4 entries to prevent noise. Previous session DNA can be toggled on to see the historical track record.
Inter-Session Flow tracks whether London tends to continue or reverse Asian's direction, and whether NY follows London. The dashboard shows this as a plain-English prediction: "NY likely bullish" or "NY may reverse" — combining the historical continuation rate with the current session's actual direction.
Anomaly Detection monitors six types of unusual conditions in real time: range anomalies (session range far from normal), volatility spikes, timing anomalies (high/low at unusual phases), inter-session gaps, flow contradictions (direction against history), and ADR consumption rate. When anomalies fire, chart markers appear with tooltips explaining what to expect and how to adjust risk management.
Additional analytics include Session Score (a 0-100 energy rating answering "is this session worth trading?"), Regime Detection (classifying the market as Trending, Ranging, Volatile, or Dead — merged into the dashboard verdict), and Efficiency tracking.
*Analytics Layer on XAUUSD 15m: Session DNA narrative boxes below each session — "Bear - Bull" shows the Asian session started bearish then flipped bullish, "Bear" shows the current London session is bearish. Dashboard in Analytics view shows DNA (Live), Flow prediction ("NY likely bearish"), Range ("Compressed"), Efficiency ("Choppy"), and Anomaly status.*
⚙️ **Multi-Timeframe Adaptivity**
Sessions + automatically adapts its behavior based on the chart timeframe. This is not a feature you toggle — it happens intelligently.
On sub-hourly timeframes (1m through 45m): full session experience with boxes, labels, DNA, killzones, all levels, and the complete dashboard.
On hourly timeframes (1H through 4H): session boxes remain but session labels are suppressed to prevent clutter. Killzones and sub-hourly features are disabled. The dashboard shows session context without granular details.
On daily and higher timeframes: session boxes are completely hidden. The indicator pivots to institutional reference levels — PDH/PDL, PWH/PWL, PMH/PML, PQH/PQL, and ADR projections. The dashboard adapts its rows to show higher-timeframe context: "Below Yesterday's Close", "Near Weekly High", "Mid Monthly Range". This means traders can keep Sessions + on their chart across all timeframes without it breaking or showing meaningless data.
*Daily chart on BTCUSD: Sessions + automatically shows institutional levels only — PMH (79356), PML (60072, red), PDH/PDC (dashed), ADR High/Low projections. No session boxes, no intraday clutter. Dashboard shows higher-timeframe context: Verdict "Ranging", vs Yesterday, Weekly position, Monthly position, and ADR status.*
⚙️ **Alert System**
Sessions + provides 39 alert conditions through PulseWire's built-in alert system. All conditions are always active — traders choose which to enable through PulseWire's alert dialog. Conditions include: session start/end events, killzone activations, ADR exhaustion, anomaly detection, regime changes, PO3 phase transitions, Silver Bullet window events, and more.
⚙️ **Settings and Customization**
The indicator has approximately 70 configurable inputs organized into clear groups: Main Settings (asset class, history, lookback), Session Config (times, box style, early/extended detection), Levels Layer (each level type individually toggleable), ICT Layer (each concept independently controlled with individual killzone toggles), Analytics Layer (DNA, regime, flow, score, anomaly), Display (dashboard view, position, size, labels), and Colors (every element customizable). Every non-color input includes a tooltip explaining what it does and why it matters.
⚠️ **Limitations and Honest Caveats**
Sessions + is a technical analysis tool with inherent limitations:
No indicator predicts the future. Session DNA, flow analysis, and regime detection are based on historical patterns and VWAP positioning — they provide probabilistic context, not certainty. Past session behavior does not guarantee future performance. The indicator is designed for intraday and swing trading on liquid markets. On illiquid instruments or during holidays, session behavior may be abnormal and analytics less reliable. Killzone effectiveness grades need sufficient historical data to stabilize — expect "Building data..." for the first several sessions. Anomaly detection sensitivity affects how many markers appear — higher sensitivity means more alerts, some of which may be noise. Session times use forex convention by default (UTC-based). Stock traders should note that the Asian session box covers Tokyo hours, not US pre-market. ADR projections assume symmetric distribution from the midnight open, which is a simplification — markets often have directional bias. The indicator uses 7 request.security calls (well within limits) but traders running multiple multi-timeframe indicators should be aware of potential resource constraints.
⚠️ **Risk Disclaimer**
All content, tools, scripts, and educational material provided are purely for informational and educational purposes. This indicator does not constitute financial, investment, or trading advice. Trading involves substantial risk of loss. Past performance and historical analysis do not guarantee future results. Users are solely responsible for their own trading decisions. Always conduct your own due diligence and consult a qualified financial advisor before making investment decisions.
Indicator

Indicator

Indicator

Indicator

Indicator

[ A L P H A X ] Structure - Smart Money Concepts [SMC]AlphaX Structure — Smart Money Concepts: BOS, CHoCH, Order Blocks, FVG, Liquidity Sweeps, Equal H/L, Displacement & Live Dashboard
AlphaX Structure is a comprehensive Smart Money Concepts (SMC) and ICT-methodology visualization tool that automatically maps market structure, institutional order flow zones, imbalances, and liquidity levels on your chart. It detects Break of Structure, Change of Character, Order Blocks with touch tracking, Fair Value Gaps with real-time fill percentage, liquidity sweeps, equal highs and lows, displacement candles, premium and discount zones — all presented through a clean, professional interface with a live dashboard showing market context at a glance.
Built for traders who analyze markets through the lens of institutional order flow and smart money behavior.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📐 Market Structure — BOS & CHoCH
The foundation of smart money analysis is understanding where structure breaks and when character changes .
Break of Structure (BOS)
A BOS occurs when price breaks a swing high or swing low in the direction of the existing trend — confirming that the current trend is continuing. BOS is plotted as a dashed horizontal line at the broken level with a "BOS" label offset slightly above or below for clear visibility.
Bullish BOS — price closes above a prior swing high while the market is already in a bullish structure. This confirms buyers remain in control and the uptrend is intact.
Bearish BOS — price closes below a prior swing low while the market is already in a bearish structure. This confirms sellers remain dominant and the downtrend continues.
Change of Character (CHoCH)
A CHoCH occurs when price breaks a swing high or swing low against the direction of the existing trend — signaling a potential trend reversal. CHoCH is plotted as a dotted horizontal line (visually distinct from BOS) with a "CHoCH" label.
Bullish CHoCH — price closes above a swing high while the market was previously bearish. This is the first structural sign that sellers may have lost control and a bullish reversal is forming.
Bearish CHoCH — price closes below a swing low while the market was previously bullish. This warns that buyers may be exhausted and a bearish reversal could be underway.
CHoCH is the earliest structural reversal signal. When you see a CHoCH followed by a BOS in the new direction, the trend shift is confirmed.
The indicator tracks the internal market trend state automatically. Once a bullish CHoCH fires, all subsequent structure breaks in the same direction are classified as BOS (continuation) until a bearish CHoCH resets the trend — and vice versa.
Swing Classification
When swing point labels are enabled, each pivot is classified as:
HH — Higher High (bullish continuation)
HL — Higher Low (bullish continuation)
LH — Lower High (bearish continuation)
LL — Lower Low (bearish continuation)
This gives you the complete market structure sequence — HH + HL = uptrend, LH + LL = downtrend — at a glance without manually marking swings.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📦 Order Blocks (OB) — With Touch Tracking
Order Blocks are the last opposing candle before a strong move — the zone where institutional orders were placed. AlphaX Structure detects Order Blocks automatically using two methods:
Engulfing Pattern Detection — a candle that fully engulfs the prior candle's body, indicating aggressive institutional entry
Strong Displacement Detection — a candle that breaks through two prior bars' highs or lows, showing powerful directional commitment
Each Order Block is drawn as a filled box spanning the body of the origin candle. The box extends forward in time, remaining on the chart as a potential reaction zone.
What makes this unique — Touch Counting:
Most SMC indicators simply show or hide Order Blocks. AlphaX Structure tracks how many times price retests each Order Block and displays the count directly on the label:
OB — fresh, untested Order Block
OB ×1 — price has retested this zone once
OB ×2 — price has retested this zone twice
OB ×3+ — multiple retests — the zone is weakening
This is critical information. A fresh OB with zero touches is the highest probability reaction zone. An OB that has been tested 3 or more times is significantly weaker — institutional orders at that level have likely been filled, and the zone may fail on the next test.
Mitigation:
When price closes through an Order Block (beyond its far edge), the OB is considered mitigated . It grays out and stops extending — visually clearing the chart while preserving the historical record of where the zone existed.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚡ Fair Value Gaps (FVG) — With Fill Percentage
A Fair Value Gap is a three-candle imbalance where the wick of the first candle and the wick of the third candle do not overlap — creating a gap in price that represents inefficient price delivery. These gaps act as magnets that price tends to return to and fill.
Bullish FVG — gap between the high of candle 1 and the low of candle 3 (upward imbalance). Price tends to pull back down to fill this gap before continuing higher.
Bearish FVG — gap between the low of candle 1 and the high of candle 3 (downward imbalance). Price tends to push back up to fill this gap before continuing lower.
Each FVG is drawn as a dotted-border box with a midpoint line through the center. The midpoint represents the 50% level of the imbalance — often the precise level where price reacts.
What makes this unique — Real-Time Fill Percentage:
AlphaX Structure calculates and displays how much of each FVG has been filled as price returns to the zone:
FVG — unfilled gap, no price has entered the zone
FVG 35% — price has partially filled 35% of the gap
FVG 72% — price has filled most of the gap
FVG ✓ — gap has been fully mitigated (price closed through the entire zone)
This gives you precision that no standard FVG indicator provides. A gap that is 70% filled but holding at the midpoint is behaving differently than one that was filled in a single candle. The fill percentage helps you judge whether the imbalance has been respected (potential bounce) or is being aggressively closed (continuation through).
A minimum FVG size filter (in ticks) is available to remove insignificant micro-gaps that clutter the chart on lower timeframes.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💰 Liquidity Sweeps
Liquidity sweeps occur when price wicks beyond a recent high or low but closes back inside the range — indicating a stop hunt or liquidity grab by institutional players. This is one of the most important concepts in ICT methodology.
Buy-side Sweep — price wicks above the recent highest high (grabbing buy-stop liquidity) but closes back below with a bearish candle. This often precedes a reversal lower. Labeled as "$ sweep" above the bar.
Sell-side Sweep — price wicks below the recent lowest low (grabbing sell-stop liquidity) but closes back above with a bullish candle. This often precedes a reversal higher. Labeled as "$ sweep" below the bar.
The lookback period for defining "recent" highs and lows is configurable, allowing you to tune sensitivity from tight scalping sweeps to broader swing-level liquidity grabs.
Liquidity sweeps are most powerful when they occur at key levels — equal highs/lows, Order Block zones, or previous day/week extremes. When a sweep aligns with an OB or FVG, the probability of a reaction increases significantly.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚖ Equal Highs & Equal Lows (EQH / EQL)
When two consecutive swing highs or swing lows form at approximately the same price, they create a liquidity pool . Retail traders place stops just beyond these levels, and institutional players know exactly where those stops are clustered.
EQH (Equal Highs) — two swing highs at nearly identical prices. A dashed line extends forward marking this level as a target for buy-side liquidity sweeps. Market makers frequently drive price above equal highs to trigger stops before reversing.
EQL (Equal Lows) — two swing lows at nearly identical prices. A dashed line marks this as a sell-side liquidity target. Expect price to sweep below before potentially reversing.
The tolerance for what counts as "equal" is configurable as a percentage (default 0.02%). This prevents false matches while catching genuinely significant double-top and double-bottom liquidity formations.
Equal Highs and Equal Lows are prime targets — when you see price approaching an EQH from below or an EQL from above, be prepared for either a sweep-and-reverse or a clean breakout. The market structure context (BOS vs CHoCH) and the presence of nearby Order Blocks will help you determine which scenario is more likely.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔥 Displacement Candles
Displacement represents aggressive institutional commitment — a candle whose body is significantly larger than normal, showing that smart money entered with force. AlphaX Structure identifies displacement candles using two criteria:
The candle body must exceed the Average True Range (ATR) multiplied by a configurable factor (default 2.0×)
The body must occupy more than 60% of the total candle range (strong body-to-wick ratio — institutional candles close near their extreme, not in the middle)
Bullish displacement candles are marked with a diamond below the bar. Bearish displacement candles are marked with a diamond above the bar.
Displacement candles are the engine behind structure breaks . When a BOS or CHoCH is accompanied by a displacement candle, the move has genuine institutional backing. When structure breaks occur on weak, indecisive candles, the break is more likely to fail.
Additionally, displacement candles often create Fair Value Gaps . When you see a displacement diamond next to an FVG box, you know the imbalance was created by a powerful move — making that FVG a higher-probability reaction zone.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💪 Candle Strength Dots
An optional feature that marks individual candles based on their relative strength compared to the ATR:
Strong Bullish Candle — body exceeds 1.2× ATR with body ratio above 55%, bullish close. Dot appears below the bar.
Strong Bearish Candle — same criteria, bearish close. Dot appears above the bar.
This is a quick visual filter for identifying which candles represent genuine conviction versus noise. Disabled by default to keep the chart clean — enable it when you want granular candle-level analysis.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 Premium & Discount Zones
The indicator calculates the current trading range using a configurable lookback period and divides it into:
Premium Zone — the upper 25% of the range, shaded with the bear color. In ICT methodology, the premium zone is where smart money sells. Buying in premium is inherently risky.
Discount Zone — the lower 25% of the range, shaded with the bull color. This is where smart money buys. Selling in discount is inherently risky.
Equilibrium (EQ) — the exact 50% midpoint of the range, marked with a dotted cross line. This is the fair value level. Price above EQ is in premium territory; price below EQ is in discount territory.
The Premium and Discount zones are drawn using boxes and lines that do not affect the chart's price scale — your candles will always display at their natural size regardless of the range lookback setting.
The dashboard displays your exact position within the range as a percentage: "DISCOUNT 18%" means price is in the lower 18% of the range — deep discount. "PREMIUM 85%" means price is in the upper portion — extended and vulnerable to pullback.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 Live Dashboard
A comprehensive real-time reference panel that updates on every bar, providing complete market context without needing to scan the chart:
STRUCTURE — current market structure direction: ▲ BULLISH, ▼ BEARISH, or — NEUTRAL, based on the most recent BOS or CHoCH
EMA BIAS — longer-term directional bias based on price position relative to 50 and 200 EMA alignment
ZONE — whether price is currently in PREMIUM, UPPER EQ, LOWER EQ, or DISCOUNT territory, with exact percentage
EQ LEVEL — the exact price of the current range equilibrium, formatted to the instrument's tick size
RSI (14) — current RSI value, color-coded: green in oversold territory, red in overbought, neutral in the middle
VOLATILITY — current volatility regime (HIGH / NORMAL / LOW) based on ATR as a percentage of price, with the exact ATR value
VOLUME — current volume relative to the 20-period average: SPIKE (>2×), ABOVE AVG (>1.3×), NORMAL, or DRY (<0.7×)
ORDER BLOCKS — number of currently active (unmitigated) Order Blocks, broken down by bullish and bearish count
FAIR VALUE GAPS — number of currently active (unfilled) FVGs, broken down by bullish and bearish count
SWING HIGH — the most recent confirmed swing high price
SWING LOW — the most recent confirmed swing low price
The dashboard title "A L P H A X S T R U C T U R E" is displayed in the signature yellow-green theme color. All values are color-coded to match their significance — bullish values in yellow-green, bearish values in red, neutral in gray.
Dashboard position (Top Left, Top Right, Bottom Left, Bottom Right) and text size (Tiny, Small, Normal) are fully configurable.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎨 Visual Design Philosophy
AlphaX Structure follows a strict dual-tone color theme for maximum clarity:
Yellow-Green (#c8e624) — all bullish elements: bullish BOS, bullish OBs, bullish FVGs, equal lows, discount zones, bullish displacement, sweep recoveries
Red (#ff1744) — all bearish elements: bearish BOS, bearish OBs, bearish FVGs, equal highs, premium zones, bearish displacement, sweep rejections
Gray (#555555) — neutral and mitigated elements: mitigated OBs and FVGs, equilibrium line, inactive zones
Structure labels (BOS, CHoCH, OB, FVG, EQH, EQL) are offset from their reference lines by a dynamic ATR-based spacing value. This ensures labels never sit directly on top of the lines they reference — maintaining readability at any zoom level and on any instrument.
All label sizes are configurable from a single setting (Tiny, Small, Normal, Large), and structure line widths for BOS and CHoCH are independently adjustable.
Mitigated zones are visually dimmed — OB and FVG boxes turn gray with increased transparency, clearly distinguishing active zones from historical ones without removing them from the chart entirely.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🚀 How to Read AlphaX Structure — Step by Step
Step 1 — Identify the Trend
Check the dashboard: what does STRUCTURE say? What does EMA BIAS say?
If both agree (both bullish or both bearish), you have a confirmed directional environment
If they disagree, the market may be in transition — wait for alignment
Step 2 — Locate Key Levels
Identify active Order Blocks — these are your primary reaction zones
Note any unfilled FVGs — price is likely to return to these imbalances
Check for Equal Highs or Equal Lows — these are liquidity targets
Step 3 — Determine Premium or Discount
Check the ZONE reading in the dashboard
In a bullish trend, look for entries in DISCOUNT or LOWER EQ
In a bearish trend, look for entries in PREMIUM or UPPER EQ
Avoid entering long in deep premium or short in deep discount — you are fighting the range
Step 4 — Wait for Confluence
The highest probability setups occur when multiple elements align at the same price level
Example: A bullish OB with zero touches sitting inside the discount zone, with an unfilled bullish FVG overlapping the same area, and a recent sell-side liquidity sweep just below — this is a textbook smart money long entry
Example: A bearish CHoCH forms at a premium zone equal high, followed by a displacement candle creating a bearish FVG — this is a high-probability short setup
Step 5 — Monitor Displacement
When structure breaks occur, check for displacement diamonds
BOS or CHoCH with displacement = high conviction move
BOS or CHoCH without displacement = weaker break, may fail or consolidate
Step 6 — Track FVG Fill Progress
As price returns to an FVG, watch the fill percentage update in real time
If price fills to 50% (the midpoint line) and rejects — the FVG is acting as support or resistance
If price fills beyond 70% — the imbalance is mostly resolved, the level is losing significance
If the label shows "FVG ✓" — the gap is fully mitigated, it is no longer a valid zone
Step 7 — Count OB Touches
Fresh OBs (zero touches) are the strongest — institutional orders are still there
OBs with 1–2 touches are still valid but weakening
OBs with 3+ touches — expect the zone to break on the next test. Consider trading the break rather than the bounce
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚡ Key Features Summary
📐 Automatic Break of Structure (BOS) and Change of Character (CHoCH) detection with proper trend state tracking
📦 Order Blocks with real-time touch counting — know exactly how many times each zone has been tested
⚡ Fair Value Gaps with live fill percentage — see partial fills update as price enters the zone
✓ FVG mitigation checkmark — clear visual confirmation when an imbalance is fully resolved
💰 Liquidity sweep detection — buy-side and sell-side stop hunts automatically identified
⚖ Equal Highs and Equal Lows — institutional liquidity pool targets marked with extension lines
🔥 Displacement candle detection — identify the high-conviction institutional candles behind structure breaks
💪 Optional candle strength dots — quick visual filter for strong vs weak bars
🎯 Premium and Discount zones with equilibrium line — know whether you are buying cheap or expensive
📋 12-row live dashboard — structure, EMA bias, zone, RSI, volatility, volume, active OB/FVG counts, swing levels
🏷 HH / HL / LH / LL swing classification labels — complete market structure sequence at a glance
🎨 Clean dual-tone color theme — yellow-green bullish, red bearish, gray neutral — no visual clutter
📏 ATR-based label spacing — labels never overlap their reference lines regardless of instrument or timeframe
⚙ Fully configurable — label size, line widths, max drawings, transparency, lookback periods, all from the settings panel
🔔 18 alert conditions covering every event type including combined alerts for multi-condition monitoring
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙ Settings Reference
Structure
Swing Detection Length — number of bars on each side to confirm a pivot (default: 5)
Show Break of Structure — toggle BOS lines and labels
Show Change of Character — toggle CHoCH lines and labels
Show Swing Points — toggle HH/HL/LH/LL labels at pivots
Max Structure Lines — limit on total BOS/CHoCH drawings (default: 15)
Order Blocks
Show Order Blocks — toggle OB detection and drawing
Remove Mitigated OBs — gray out and stop extending OBs that price has closed through
Max Order Blocks — maximum active OB drawings (default: 8)
Bullish / Bearish OB Color — independent color pickers
OB Fill Transparency — control how transparent the OB fill appears (default: 88)
Fair Value Gaps
Show Fair Value Gaps — toggle FVG detection and drawing
Remove Mitigated FVGs — gray out and checkmark FVGs that price has fully closed through
Max FVG Boxes — maximum active FVG drawings (default: 10)
Bullish / Bearish FVG Color — independent color pickers
FVG Fill Transparency — control fill transparency (default: 90)
Min FVG Size (ticks) — filter out micro-gaps below this threshold
Liquidity
Show Liquidity Sweeps — toggle sweep detection labels
Liquidity Lookback — how many bars to look back for the recent high/low that defines the sweep level (default: 20)
Buy-side / Sell-side Sweep Color — independent color pickers
Equal H/L
Show Equal Highs / Lows — toggle EQH/EQL detection
Equal Level Tolerance % — how close two swing pivots must be to qualify as "equal" (default: 0.02%)
Equal Highs / Lows Color — independent color pickers
Premium & Discount
Show Premium/Discount — toggle zone boxes and equilibrium line
Range Lookback — how many bars to calculate the current range (default: 50)
Discount / Premium Zone Color — independent color pickers
Displacement
Show Displacement Candles — toggle displacement diamond markers
ATR Multiplier — how many times larger than ATR the candle body must be (default: 2.0)
ATR Period — the ATR calculation period (default: 14)
Bull / Bear Displacement Color — independent color pickers
Candle Strength
Show Candle Strength Dots — toggle strong candle markers (default: off)
Strength ATR Period — ATR period for strength comparison (default: 14)
Appearance
Label Size — Tiny, Small, Normal, or Large for all chart labels
Structure Line Width — thickness of BOS lines (default: 1)
CHoCH Line Width — thickness of CHoCH lines (default: 2)
Dashboard
Show Dashboard — toggle the information panel
Dashboard Position — Top Left, Top Right, Bottom Left, or Bottom Right
Dashboard Text Size — Tiny, Small, or Normal
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔔 Alert Conditions (18 Total)
Individual Alerts:
Bullish BOS — fires when a bullish Break of Structure is confirmed
Bearish BOS — fires when a bearish Break of Structure is confirmed
Bullish CHoCH — fires when a bullish Change of Character is detected
Bearish CHoCH — fires when a bearish Change of Character is detected
Buy-side Liquidity Sweep — fires when price sweeps above recent highs and closes back below
Sell-side Liquidity Sweep — fires when price sweeps below recent lows and closes back above
Bullish FVG Formed — fires when a new bullish Fair Value Gap is created
Bearish FVG Formed — fires when a new bearish Fair Value Gap is created
Bullish OB Formed — fires when a new bullish Order Block is detected
Bearish OB Formed — fires when a new bearish Order Block is detected
Bullish Displacement — fires when a bullish displacement candle is confirmed
Bearish Displacement — fires when a bearish displacement candle is confirmed
Combined Alerts:
Any Bullish Structure Break — fires on either bullish BOS or bullish CHoCH
Any Bearish Structure Break — fires on either bearish BOS or bearish CHoCH
Any Liquidity Sweep — fires on either buy-side or sell-side sweep
Any FVG Formed — fires on either bullish or bearish FVG
Any OB Formed — fires on either bullish or bearish Order Block
Any Displacement Candle — fires on either bullish or bearish displacement
All alert messages are prefixed with and include ticker, interval, and price for clean webhook and notification integration.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
👥 Who This Is For
🧠 ICT and SMC traders — every core concept is mapped automatically: BOS, CHoCH, OB, FVG, liquidity sweeps, EQH/EQL, premium/discount, displacement
🥇 Gold (XAUUSD) traders — gold's price action is heavily driven by institutional order flow and liquidity sweeps; this tool maps exactly where those events occur
📉 Forex traders — applicable to all major and minor pairs; session-based liquidity sweeps are particularly effective on EURUSD, GBPUSD, and USDJPY
📊 Index traders — works on US30, NAS100, SPX500, DAX — Order Blocks and FVGs are core institutional concepts on indices
📈 Traders who want clean charts — every element uses the same dual-tone theme with proper spacing, mitigation graying, and configurable drawing limits. No clutter, no overlapping elements
⚠ Traders learning SMC methodology — the indicator maps every concept in real time, making it an excellent study tool for understanding how structure, order flow, and liquidity interact
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📝 Notes
Designed for intraday to swing timeframes — M1 through H4. Works on daily and weekly charts but intraday timeframes provide the best resolution for OB and FVG detection.
Premium and Discount zones are drawn using boxes and lines on the last bar only — they do not affect the chart's vertical price scale. Your candles will always display at their natural size.
Structure detection uses bar close confirmation — a swing high or low must be confirmed by the configured number of bars on each side before it is recognized as a pivot.
The maximum number of drawings for OBs, FVGs, structure lines, and EQ lines are all independently configurable. Older drawings beyond the limit are automatically removed.
Touch counting on Order Blocks uses a de-duplication method — price must leave the OB zone and re-enter to count as a new touch. Consecutive bars inside the same OB count as one touch.
FVG fill percentage is calculated based on the deepest penetration into the gap — even if price subsequently leaves the zone, the fill percentage reflects the maximum penetration achieved.
All calculations are non-repainting — signals are confirmed on bar close.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Disclaimer
This indicator is a technical analysis and visualization tool intended for educational and informational purposes only. It does not constitute financial advice or a recommendation to buy or sell any financial instrument. All structure levels, Order Blocks, Fair Value Gaps, and liquidity levels shown are derived from historical price data and their significance as support, resistance, or reaction zones is not guaranteed. Smart Money Concepts and ICT methodology are interpretive frameworks — they describe market behavior patterns but do not predict future price action with certainty. Past reactions at these levels do not guarantee future reactions. Always conduct your own analysis, use proper risk management, and consult a licensed financial advisor before making any trading decisions. The author accepts no responsibility for any losses incurred from the use of this indicator.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Built for traders who read the market the way institutions move it. Indicator

SMT Divergence [UAlgo]SMT Divergence is a comparative market structure indicator designed to detect disagreement between a primary instrument and a second reference symbol. The script looks for situations where the main chart prints a stronger structural move, while the comparison symbol fails to confirm that move. This kind of disagreement is often referred to as SMT divergence and is commonly used to identify potential weakness in continuation or hidden strength into reversal conditions.
The script works by tracking confirmed swing highs and swing lows on both instruments. Once enough pivots are stored, it compares the latest structural movement in the primary chart against the latest comparable movement in the reference symbol. If the primary chart makes a lower low while the comparison symbol makes a higher low, the script identifies bullish SMT divergence. If the primary chart makes a higher high while the comparison symbol makes a lower high, the script identifies bearish SMT divergence.
What makes this script especially practical is its flexible comparison logic. It can work in a time matched mode, where the comparison swings must occur near the same bars as the primary swings, or in an independent mode, where the script simply uses the most recent valid swings from both instruments. It also supports inverse correlation logic, allowing the user to compare instruments that normally move in opposite directions.
The indicator can then display SMT labels directly on the main chart, draw structure lines between the relevant swing points, show a live information table, and optionally render the comparison symbol as candles inside the oscillator pane. This creates a complete workflow for divergence monitoring instead of only printing occasional labels.
In practical use, SMT Divergence can help traders identify moments when the primary symbol appears to be making an aggressive structural move without proper confirmation from a related market. These moments can provide useful context for potential exhaustion, liquidity events, or directional imbalance between correlated instruments.
🔹 Features
🔸 Dual Symbol Market Structure Comparison
The script compares the active chart against a second user selected symbol. Both instruments are processed using the same pivot logic, which creates a consistent framework for structural comparison.
🔸 Bullish SMT Detection
Bullish SMT is identified when the primary chart makes a lower low while the comparison symbol makes a higher low. This can suggest hidden relative strength in the comparison instrument or possible exhaustion in the primary one.
🔸 Bearish SMT Detection
Bearish SMT is identified when the primary chart makes a higher high while the comparison symbol makes a lower high. This can suggest weakening confirmation and possible vulnerability in the primary move.
🔸 Positive and Inverse Correlation Modes
The script supports both normal and inverse correlation logic. In normal mode, lows are compared with lows and highs are compared with highs. In inverse mode, lows are compared with highs and highs are compared with lows. This makes the tool flexible enough for both positively correlated and negatively correlated markets.
🔸 Time Matched and Independent Swing Modes
The user can choose whether swing comparison should require approximate time alignment or simply use the most recent valid swings from each symbol. This allows the script to be either stricter or more flexible depending on the relationship between the two markets.
🔸 Pivot Strength Control
Swing highs and lows are built from confirmed pivots using user defined left and right bar settings. This allows the user to control how sensitive or how selective the swing structure should be.
🔸 Minimum Price Difference Filter
A minimum price difference percentage can be required before a divergence is accepted. This helps avoid labeling very small and potentially insignificant swing differences.
🔸 Max Swing Memory Control
The script stores a limited number of recent swings for both the primary and comparison symbol. This keeps the logic focused on relevant structure and prevents unnecessary buildup of stale pivots.
🔸 On Chart Labels and Lines
Detected SMT events can be labeled directly on the main chart. The script can also draw structure lines across the primary and comparison swing legs used in the divergence.
🔸 Live Info Table
An information table can display the active comparison symbol, correlation mode, divergence count, and the latest signal direction. This makes the script easier to monitor in real time.
🔸 Optional Compare Candle Panel
The comparison symbol can be plotted as candles in the indicator pane. This allows the user to visually inspect whether the second instrument is confirming or rejecting the move seen in the primary chart.
🔸 Alert Support
The script includes separate alerts for bullish SMT, bearish SMT, and any SMT event.
🔹 Calculations
1) Defining Swing and Divergence Objects
type SwingPoint
int barIdx
int barTm
float price
bool isHigh
type SMTDivergence
int barIdx
int barTm
bool isBullish
float primaryPrice
float comparePrice
string primarySymbol
string compareSymbol
label lbl
line ln1
line ln2
type SymbolData
float h
float l
float c
This is the structural base of the whole script.
A SwingPoint stores one confirmed pivot with its bar index, time, price, and whether it is a high or a low.
An SMTDivergence object stores the final event once a divergence is confirmed. It keeps the primary and comparison prices, the involved symbols, the direction, and the visual references used for labels and lines.
A SymbolData object is used as a clean container for each symbol’s high, low, and close series.
So before any logic runs, the script already has a full structure for swing storage and divergence output.
2) Requesting the Comparison Symbol Data
= request.security(compareSymbolInput, timeframe.period, , lookahead = barmerge.lookahead_off)
SymbolData primaryData = SymbolData.new(high, low, close)
SymbolData compareData = SymbolData.new(compareHigh, compareLow, compareClose)
This block loads the second symbol on the same chart timeframe.
The primary chart uses the current symbol’s own high, low, and close. The comparison symbol is requested with request.security , and its values are placed into a matching data structure.
This means both symbols are analyzed on an equal timeframe basis, which is essential for consistent swing comparison.
3) Finding Pivot Highs and Pivot Lows on Both Symbols
float primaryPivotHigh = ta.pivothigh(primaryData.h, pivotLeftBars, pivotRightBars)
float primaryPivotLow = ta.pivotlow(primaryData.l, pivotLeftBars, pivotRightBars)
float comparePivotHigh = ta.pivothigh(compareData.h, pivotLeftBars, pivotRightBars)
float comparePivotLow = ta.pivotlow(compareData.l, pivotLeftBars, pivotRightBars)
This is the swing discovery engine.
The script uses the same pivot settings for both instruments. A pivot high or pivot low is only confirmed after the required number of bars has passed on each side.
This means the divergence engine is built from confirmed structure, not from temporary highs and lows that can disappear before confirmation.
4) Storing Swings in Memory
method addSwing(array swings, SwingPoint newSwing) =>
swings.push(newSwing)
if swings.size() > maxSwingsToStore
swings.shift()
swings
if not na(primaryPivotHigh)
primarySwings.addSwing(SwingPoint.new(bar_index - pivotOffset, time , primaryPivotHigh, true))
if not na(primaryPivotLow)
primarySwings.addSwing(SwingPoint.new(bar_index - pivotOffset, time , primaryPivotLow, false))
if not na(comparePivotHigh)
compareSwings.addSwing(SwingPoint.new(bar_index - pivotOffset, time , comparePivotHigh, true))
if not na(comparePivotLow)
compareSwings.addSwing(SwingPoint.new(bar_index - pivotOffset, time , comparePivotLow, false))
Once a pivot is confirmed, it is pushed into the appropriate swing array.
The true pivot bar is pivotRightBars bars in the past, so the script subtracts that offset from the current bar index and time. Each array only keeps the latest user defined number of swings.
So the script maintains a rolling structural memory for both markets without allowing the arrays to grow indefinitely.
5) Retrieving the Latest and Previous Swings
method getLastSwing(array swings, bool isHigh) =>
SwingPoint result = na
if swings.size() > 0
for i = swings.size() - 1 to 0
SwingPoint sw = swings.get(i)
if sw.isHigh == isHigh
result := sw
break
result
method getPreviousSwing(array swings, bool isHigh) =>
SwingPoint result = na
int count = 0
if swings.size() > 1
for i = swings.size() - 1 to 0
SwingPoint sw = swings.get(i)
if sw.isHigh == isHigh
count += 1
if count == 2
result := sw
break
result
These two helper methods are used to build the swing pairs required for divergence detection.
getLastSwing returns the most recent high or low swing of the requested type.
getPreviousSwing returns the swing before that.
This is important because SMT logic always compares two consecutive structure points on the primary side and two corresponding structure points on the comparison side.
6) Enforcing Maximum Distance Between Swing Points
method isWithinRange(SwingPoint sw1, SwingPoint sw2) =>
not na(sw1) and not na(sw2) and math.abs(sw1.barIdx - sw2.barIdx) <= maxBarsLookback
This method makes sure the two swings being compared are not too far apart in time.
If the latest and previous swing are separated by more than the allowed bar distance, the setup is ignored.
This helps keep the analysis focused on fresh and structurally related moves rather than comparing swings that are too old or too distant to be meaningful together.
7) Time Matched Swing Search
method findSwingNearBar(array swings, int targetBar, bool isHigh, int toleranceBars) =>
SwingPoint result = na
int minDiff = 999999
if swings.size() > 0
for i = swings.size() - 1 to 0
SwingPoint sw = swings.get(i)
if sw.isHigh == isHigh
int diff = math.abs(sw.barIdx - targetBar)
if diff <= toleranceBars and diff < minDiff
minDiff := diff
result := sw
result
This method is used only when the user selects time matched mode.
The idea is to find a comparison symbol swing that occurred near the same bar as the primary swing. The script searches for the nearest swing of the correct type inside the allowed tolerance window.
So time matched mode is stricter because it requires approximate timing alignment between the two instruments.
8) Minimum Price Difference Filter
method pctDiff(float price1, float price2) =>
math.abs(price1 - price2) / ((price1 + price2) / 2) * 100
This function measures the percentage difference between two prices.
The result is later used as an optional minimum swing magnitude filter. If the primary chart’s new swing differs only slightly from its previous one, the script can ignore that divergence candidate.
So the minimum difference filter helps reduce weaker signals that are based on very small structure changes.
9) Bullish SMT Detection Logic
if not na(primaryPivotLow) and not na(primaryLastLow) and not na(primaryPrevLow)
SwingPoint usedCompareLast = na
SwingPoint usedComparePrev = na
bool targetSwingHigh = inverseCorrelation ? true : false
if useTimeMatching
usedCompareLast := compareSwings.findSwingNearBar(primaryLastLow.barIdx, targetSwingHigh, timeToleranceBars)
usedComparePrev := compareSwings.findSwingNearBar(primaryPrevLow.barIdx, targetSwingHigh, timeToleranceBars)
else
usedCompareLast := compareSwings.getLastSwing(targetSwingHigh)
usedComparePrev := compareSwings.getPreviousSwing(targetSwingHigh)
This is the setup stage for bullish SMT.
The script only begins the test when a new primary pivot low has just been confirmed and both the latest and previous primary lows are available.
Then it decides what kind of comparison swings are needed.
In normal correlation mode, bullish SMT compares primary lows to comparison lows.
In inverse correlation mode, bullish SMT compares primary lows to comparison highs.
Then the script either uses time matched lookup or independent swing retrieval depending on the chosen mode.
So before the bullish condition itself is tested, the script first builds the proper comparison pair according to both timing mode and correlation mode.
10) Bullish SMT Confirmation Conditions
if not na(usedCompareLast) and not na(usedComparePrev)
if primaryLastLow.isWithinRange(primaryPrevLow)
bool primaryLL = primaryLastLow.price < primaryPrevLow.price
bool compareHL = inverseCorrelation ? (usedCompareLast.price < usedComparePrev.price) : (usedCompareLast.price > usedComparePrev.price)
bool meetsMinDiff = minPriceDiff == 0.0 or (primaryLastLow.price.pctDiff(primaryPrevLow.price) >= minPriceDiff)
Bullish SMT is confirmed when three things happen.
First, the primary chart must make a lower low:
primaryLastLow.price < primaryPrevLow.price
Second, the comparison symbol must fail to confirm that weakness. In normal correlation mode this means the comparison symbol makes a higher low. In inverse correlation mode the logic is adjusted accordingly because the relationship is reversed.
Third, if the minimum difference filter is enabled, the primary low must differ enough from the previous low.
So bullish SMT is essentially a lower low in the main chart that is not properly confirmed by the comparison market.
11) Creating the Bullish Divergence Event
if primaryLL and compareHL and meetsMinDiff and primaryLastLow.barIdx != lastBullPrimaryIdx
bullishSMT := true
lastBullPrimaryIdx := primaryLastLow.barIdx
SMTDivergence newDiv = SMTDivergence.new(primaryLastLow.barIdx, primaryLastLow.barTm, true, primaryLastLow.price, usedCompareLast.price, syminfo.tickerid, compareSymbolInput, na, na, na)
newDiv.drawVisuals(primaryPrevLow.barTm, primaryPrevLow.price, usedCompareLast.barTm, usedComparePrev.barTm, usedComparePrev.price)
divergences.push(newDiv)
Once the bullish conditions are met, the script creates a new SMT divergence object.
It stores the primary swing information, the comparison swing information, the involved symbols, and the bullish direction. Then it calls the visual drawing method and pushes the divergence into the history array.
The duplicate protection check against lastBullPrimaryIdx prevents the same primary swing from being labeled repeatedly.
12) Bearish SMT Detection Logic
if not na(primaryPivotHigh) and not na(primaryLastHigh) and not na(primaryPrevHigh)
SwingPoint usedCompareLastH = na
SwingPoint usedComparePrevH = na
bool targetSwingHigh = inverseCorrelation ? false : true
if useTimeMatching
usedCompareLastH := compareSwings.findSwingNearBar(primaryLastHigh.barIdx, targetSwingHigh, timeToleranceBars)
usedComparePrevH := compareSwings.findSwingNearBar(primaryPrevHigh.barIdx, targetSwingHigh, timeToleranceBars)
else
usedCompareLastH := compareSwings.getLastSwing(targetSwingHigh)
usedComparePrevH := compareSwings.getPreviousSwing(targetSwingHigh)
This is the mirror setup stage for bearish SMT.
It begins only when a new primary pivot high has been confirmed and the required primary highs exist. Then it selects the proper comparison swing type according to the chosen correlation mode.
In normal correlation mode, bearish SMT compares highs with highs.
In inverse correlation mode, bearish SMT compares highs with lows.
So this block prepares the correct structural pair for the bearish test.
13) Bearish SMT Confirmation Conditions
if not na(usedCompareLastH) and not na(usedComparePrevH)
if primaryLastHigh.isWithinRange(primaryPrevHigh)
bool primaryHH = primaryLastHigh.price > primaryPrevHigh.price
bool compareLH = inverseCorrelation ? (usedCompareLastH.price > usedComparePrevH.price) : (usedCompareLastH.price < usedComparePrevH.price)
bool meetsMinDiff = minPriceDiff == 0.0 or (primaryLastHigh.price.pctDiff(primaryPrevHigh.price) >= minPriceDiff)
Bearish SMT is confirmed when the primary chart makes a higher high while the comparison symbol fails to confirm that strength.
In normal correlation mode, the comparison symbol must make a lower high. In inverse correlation mode the logic is adjusted to preserve the intended structural disagreement.
The minimum difference filter is applied here as well.
So bearish SMT is the opposite structure of bullish SMT, focused on unconfirmed upside continuation.
14) Creating the Bearish Divergence Event
if primaryHH and compareLH and meetsMinDiff and primaryLastHigh.barIdx != lastBearPrimaryIdx
bearishSMT := true
lastBearPrimaryIdx := primaryLastHigh.barIdx
SMTDivergence newDiv = SMTDivergence.new(primaryLastHigh.barIdx, primaryLastHigh.barTm, false, primaryLastHigh.price, usedCompareLastH.price, syminfo.tickerid, compareSymbolInput, na, na, na)
newDiv.drawVisuals(primaryPrevHigh.barTm, primaryPrevHigh.price, usedCompareLastH.barTm, usedComparePrevH.barTm, usedComparePrevH.price)
divergences.push(newDiv)
Once the bearish rules are satisfied, the script creates a bearish SMT divergence object, draws its visuals, and stores it in the divergence history array.
The duplicate protection check against lastBearPrimaryIdx prevents repeated labeling of the same primary high.
15) Drawing Labels and Lines
method drawVisuals(SMTDivergence div, int prevTime, float prevPrice, int compareTime, int prevCompareTime, float prevComparePrice) =>
if showLabels
string labelText = div.isBullish ? "🔺 SMT" : "🔻 SMT"
string tooltipText = str.format("{0} SMT Divergence {1} vs {2} Price: {3}", div.isBullish ? "Bullish" : "Bearish", div.primarySymbol, div.compareSymbol, str.tostring(div.primaryPrice, format.mintick))
color labelColor = div.isBullish ? bullishColor : bearishColor
div.lbl := label.new(div.barIdx, div.primaryPrice, labelText, xloc = xloc.bar_index, yloc = div.isBullish ? yloc.belowbar : yloc.abovebar, color = labelColor, textcolor = color.white, style = div.isBullish ? label.style_label_up : label.style_label_down, tooltip = tooltipText, size = size.small, force_overlay = true)
if showLines and not na(prevTime) and not na(prevPrice)
color lineColor = div.isBullish ? bullishColor : bearishColor
div.ln1 := line.new(prevTime, prevPrice, div.barTm, div.primaryPrice, xloc = xloc.bar_time, color = lineColor, width = 2, style = line.style_solid, force_overlay = true)
if not na(prevComparePrice) and not na(prevCompareTime) and not na(compareTime)
div.ln2 := line.new(prevCompareTime, prevComparePrice, compareTime, div.comparePrice, xloc = xloc.bar_time, color = lineColor, width = 2, style = line.style_solid)
This method creates the chart visuals for each divergence.
The label is placed directly at the primary swing location, above price for bearish SMT and below price for bullish SMT.
If line drawing is enabled, the script also draws one line across the primary chart’s two relevant swing points and another line across the comparison symbol’s swing leg.
So the user can see both the signal marker and the underlying structural disagreement that produced it.
16) Limiting Divergence History
if divergences.size() > maxDivergencesToShow
SMTDivergence rmDiv = divergences.shift()
rmDiv.cleanup()
This block controls object history.
If the stored divergence count exceeds the chosen limit, the oldest divergence is removed from the array and all its visuals are deleted.
This keeps the chart clean and prevents unlimited buildup of old labels and lines.
17) Building the Information Table
var table infoTable = table.new(position.top_right, 2, 6, bgcolor = color.new(#2222b3, 10), border_width = 1, border_color = color.new(color.white, 80), frame_width = 2, frame_color = color.new(color.white, 70))
if showTable and barstate.islast
table.cell(infoTable, 0, 1, "Primary", text_color = color.gray, text_size = size.tiny)
table.cell(infoTable, 1, 1, syminfo.tickerid, text_color = color.white, text_size = size.tiny)
table.cell(infoTable, 0, 2, "Compare", text_color = color.gray, text_size = size.tiny)
table.cell(infoTable, 1, 2, compareSymbolInput, text_color = color.white, text_size = size.tiny)
table.cell(infoTable, 0, 3, "Correlation", text_color = color.gray, text_size = size.tiny)
table.cell(infoTable, 1, 3, inverseCorrelation ? "Inverse" : "Positive", text_color = inverseCorrelation ? color.orange : color.aqua, text_size = size.tiny)
table.cell(infoTable, 0, 4, "Divergences", text_color = color.gray, text_size = size.tiny)
table.cell(infoTable, 1, 4, str.tostring(divergences.size()), text_color = color.white, text_size = size.tiny)
This table provides a compact real time summary.
It shows:
the primary symbol,
the comparison symbol,
the current correlation mode,
the number of stored divergences,
and the most recent signal direction.
So the table functions as a monitoring dashboard rather than only a decorative element.
18) Determining the Last Signal for the Table
string lastSignal = "None"
color signalColor = color.gray
if divergences.size() > 0
SMTDivergence lastDiv = divergences.get(divergences.size() - 1)
lastSignal := lastDiv.isBullish ? "🔺 Bullish" : "🔻 Bearish"
signalColor := lastDiv.isBullish ? bullishColor : bearishColor
This block determines what the table should show as the latest signal.
If at least one divergence has been stored, the script reads the newest one and displays whether it was bullish or bearish, along with the corresponding color.
So the info table always reflects the current state of the divergence history.
19) Alert Conditions
alertcondition(bullishSMT, title = "Bullish SMT Divergence", message = "🔺 Bullish SMT Divergence detected on {{ticker}}! Primary made Lower Low while {{interval}} comparison made Higher Low.")
alertcondition(bearishSMT, title = "Bearish SMT Divergence", message = "🔻 Bearish SMT Divergence detected on {{ticker}}! Primary made Higher High while {{interval}} comparison made Lower High.")
alertcondition(bullishSMT or bearishSMT, title = "Any SMT Divergence", message = "SMT Divergence detected on {{ticker}}!")
The script provides three alert types.
One triggers only on bullish SMT.
One triggers only on bearish SMT.
One triggers on any SMT event.
This makes the indicator useful both for visual study and for live event monitoring.
20) Compare Candle Panel
color compareBodyColor = compareClose >= compareOpen ? color.new(#00E676, 0) : color.new(#FF5252, 0)
color compareWickColor = compareClose >= compareOpen ? color.new(#00E676, 30) : color.new(#FF5252, 30)
color compareBorderColor = compareClose >= compareOpen ? color.new(#00C853, 0) : color.new(#D50000, 0)
plotcandle(compareOpen, compareHigh, compareLow, compareClose, title = "Compare Symbol Candles", color = compareBodyColor, wickcolor = compareWickColor, bordercolor = compareBorderColor, display = showCandlePanel ? display.all : display.none)
This block renders the comparison symbol as candles inside the indicator pane.
The candle colors are determined by the comparison symbol’s own open and close direction. If the user enables the candle panel, this gives a quick visual reference for how the second instrument is behaving without needing to open a separate chart.
So the user can study SMT signals and the comparison structure in the same pane. Indicator

[ 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

IPDA Ranges ProIPDA Ranges – Pro
This indicator plots Institutional Price Delivery Algorithm (IPDA) ranges based on lookback periods of 20, 40, and 60 days, as taught by ICT (Inner Circle Trader). It visualizes premium and discount zones, equilibrium levels, quadrants, and sub-quadrants to help traders identify key price areas and potential market biases.
Key Features:
- Displays IPDA ranges as boxes or lines, with customizable colors for discount, equilibrium, and premium zones.
- Optionally shades the 25%-75% mid-zone for each range.
- Supports quadrants (25% steps) and sub-quadrants with lines and labels for detailed price segmentation.
- Includes a table displaying either discount/premium status or percentage from equilibrium for each range.
- Configurable alerts for entry/exit into the mid-zone.
- Visual options include line styles, label sizes, price display on labels, and buffers for zone extension.
Settings Overview:
- IPDA Intervals: Enable/disable IPDA20, IPDA40, IPDA60; toggle quadrants, sub-quadrants, mid-zone shading, and drawing with lines vs. boxes.
- Colors and Styles: Customize colors for zones, lines, labels; select solid/dotted/dashed styles for borders and lines.
- Appearance: Adjust label and table sizes, table position, and background opacity.
- Labels: Show/hide per-range labels and include prices.
- Alerts: Enable mid-zone entry/exit alerts.
- Includes 3-Day Lookback
Usage:
Add the indicator to your chart and select the desired IPDA intervals. The ranges update dynamically based on daily highs and lows. Use the table for quick reference to current positioning (discount/premium or percentage). The mid-zone shading helps identify consolidation areas, while quadrants and sub-quadrants assist in pinpointing potential support/resistance levels.
© MadMonkTrading Indicator

SMT Divergence & ICT KillzonesOverview
This open-source indicator combines SMT-style divergence detection, ICT killzone context, and a Midnight Open reference on a single chart. It is intended for users who want to review correlation-based divergence conditions together with fixed New York session timing and a daily reference level in one workflow.
Why this script was created
This script was created to reduce the need to switch between separate tools for SMT comparison, session timing, and daily reference levels. Instead of checking these elements one by one, the indicator keeps them on the same chart so they can be reviewed together.
How it works
The script compares confirmed swing highs and lows on the chart symbol with those of a user-selected comparison symbol. When one market confirms a new swing extension while the comparison market does not confirm a similar extension, the script marks an SMT-style divergence condition.
In addition to the divergence logic, the script highlights London and New York killzone windows using fixed New York session timing and plots Midnight Open as a daily reference line.
Signals are based on confirmed pivots, so they appear after confirmation rather than on the exact turning bar.
How to use it
Choose a comparison symbol that has a meaningful relationship with the chart symbol. For example, users may compare BTCUSDT with ETHUSDT, or use other markets that are commonly reviewed together.
A practical way to use the script is to review SMT signals together with the killzone background and the Midnight Open level rather than treating the signal marker by itself as a complete trade decision.
Standard candlestick charts are recommended for visual consistency.
Inputs
Correlation Symbol — Selects the market used for SMT comparison. The most useful results usually come from symbols with a meaningful relationship to the chart symbol.
Timeframe — Sets the timeframe used for the comparison symbol. If left empty, the chart timeframe is used. Using a different timeframe changes how often comparison pivots update and can change the timing of divergence markings.
Swing Length — Controls pivot confirmation sensitivity. Higher values require more bars to confirm a pivot, which usually produces fewer signals and more delay. Lower values react faster but can produce more frequent signals.
Show Killzone Background — Shows or hides the London and New York killzone background.
Show Midnight Open — Shows or hides the Midnight Open reference line.
Display Timezone — Controls the display-related timezone behavior used where applicable. Killzone calculations remain aligned to New York session timing.
Bearish / Bullish Color — Sets the visual colors of bearish and bullish SMT markings.
Outside Killzone Transparency — Reduces the visual emphasis of signals that form outside killzone windows. Increasing this value makes off-session signals less visually prominent.
Max Historical Objects — Limits how many historical SMT drawings remain on the chart at the same time. Lower values keep the chart cleaner, while higher values preserve more historical context.
How changing the settings affects the output
Increasing Swing Length makes pivot confirmation stricter. This usually reduces the number of signals, but it also delays them further.
Lowering Swing Length makes the script react faster, but it can also increase the number of marked conditions.
Changing the Correlation Symbol changes the relationship being evaluated. Closely related markets are usually easier to interpret than unrelated ones.
Changing the Timeframe for the comparison symbol changes the pace at which comparison pivots form, which can materially change when divergence conditions appear.
Increasing Outside Killzone Transparency makes off-session signals less visually prominent.
Reducing Max Historical Objects removes older drawings sooner and keeps the chart cleaner.
Use context
This script is most useful when the chart symbol and comparison symbol have a meaningful relationship and when session timing matters in the user’s workflow. It is designed to help users review divergence conditions together with session context and a daily reference level, rather than isolate them as separate tools.
Limitations
The usefulness of the output depends heavily on the chosen comparison symbol. Weakly related or unrelated symbols can reduce the value of SMT readings.
Because the logic uses confirmed pivots, signals appear after confirmation rather than on the exact turning bar.
In sideways or choppy conditions, divergence readings can become less informative.
Heikin Ashi, Renko, Line Break, Kagi, Point & Figure, and Range charts can produce less reliable visual interpretation because they do not use standard price construction.
Design notes
This script combines confirmed SMT-style comparison logic, fixed ICT killzone timing tied to New York session hours, and a Midnight Open reference in one workflow.
It also manages historical lines and labels so the chart does not keep accumulating drawings without limit, which helps keep the visual layout more controlled over time. 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
