Ultimate Market Structure [Alpha Extract]Ultimate Market Structure
A comprehensive market structure analysis tool that combines advanced swing point detection, imbalance zone identification, and intelligent break analysis to identify high-probability trading opportunities.Utilizing a sophisticated trend scoring system, this indicator classifies market conditions and provides clear signals for structure breaks, directional changes, and fair value gap detection with institutional-grade precision.
🔶 Advanced Swing Point Detection
Identifies pivot highs and lows using configurable lookback periods with optional close-based analysis for cleaner signals. The system automatically labels swing points as Higher Highs (HH), Lower Highs (LH), Higher Lows (HL), and Lower Lows (LL) while providing advanced classifications including "rising_high", "falling_high", "rising_low", "falling_low", "peak_high", and "valley_low" for nuanced market analysis.
swingHighPrice = useClosesForStructure ? ta.pivothigh(close, swingLength, swingLength) : ta.pivothigh(high, swingLength, swingLength)
swingLowPrice = useClosesForStructure ? ta.pivotlow(close, swingLength, swingLength) : ta.pivotlow(low, swingLength, swingLength)
classification = classifyStructurePoint(structureHighPrice, upperStructure, true)
significance = calculateSignificance(structureHighPrice, upperStructure, true)
🔶 Significance Scoring System
Each structure point receives a significance level on a 1-5 scale based on its distance from previous points, helping prioritize the most important levels. This intelligent scoring system ensures traders focus on the most meaningful structure breaks while filtering out minor noise.
🔶 Comprehensive Trend Analysis
Calculates momentum, strength, direction, and confidence levels using volatility-normalized price changes and multi-timeframe correlation. The system provides real-time trend state tracking with bullish (+1), bearish (-1), or neutral (0) direction assessment and 0-100 confidence scoring.
// Calculate trend momentum using rate of change and volatility
calculateTrendMomentum(lookback) =>
priceChange = (close - close ) / close * 100
avgVolatility = ta.atr(lookback) / close * 100
momentum = priceChange / (avgVolatility + 0.0001)
momentum
// Calculate trend strength using multiple timeframe correlation
calculateTrendStrength(shortPeriod, longPeriod) =>
shortMA = ta.sma(close, shortPeriod)
longMA = ta.sma(close, longPeriod)
separation = math.abs(shortMA - longMA) / longMA * 100
strength = separation * slopeAlignment
❓How It Works
🔶 Imbalance Zone Detection
Identifies Fair Value Gaps (FVGs) between consecutive candles where price gaps create unfilled areas. These zones are displayed as semi-transparent boxes with optional center line mitigation tracking, highlighting potential support and resistance levels where institutional players often react.
// Detect Fair Value Gaps
detectPriceImbalance() =>
currentHigh = high
currentLow = low
refHigh = high
refLow = low
if currentOpen > currentClose
if currentHigh - refLow < 0
upperBound = currentClose - (currentClose - refLow)
lowerBound = currentClose - (currentClose - currentHigh)
centerPoint = (upperBound + lowerBound) / 2
newZone = ImbalanceZone.new(
zoneBox = box.new(bar_index, upperBound, rightEdge, lowerBound,
bgcolor=bullishImbalanceColor, border_color=hiddenColor)
)
🔶 Structure Break Analysis
Determines Break of Structure (BOS) for trend continuation and Directional Change (DC) for trend reversals with advanced classification as "continuation", "reversal", or "neutral". The system compares pre-trend and post-trend states for each break, providing comprehensive trend change momentum analysis.
🔶 Intelligent Zone Management
Features partial mitigation tracking when price enters but doesn't fully fill zones, with automatic zone boundary adjustment during partial fills. Smart array management keeps only recent structure points for optimal performance while preventing duplicate signals from the same level.
🔶 Liquidity Zone Detection
Automatically identifies potential liquidity zones at key structure points for institutional trading analysis. The system tracks broken structure points and provides adaptive zone extension with configurable time-based limits for imbalance areas.
🔶 Visual Structure Mapping
Provides clear visual indicators including swing labels with color-coded significance levels, dashed lines connecting break points with BOS/DC labels, and break signals for continuation and reversal patterns. The adaptive zones feature smart management with automatic mitigation tracking.
🔶 Market Structure Interpretation
HH/HL patterns indicate bullish market structure with trend continuation likelihood, while LH/LL patterns signal bearish structure with downtrend continuation expected. BOS signals represent structure breaks in trend direction for continuation opportunities, while DC signals warn of potential reversals.
🔶 Performance Optimization
Automatic cleanup of old structure points (keeps last 8 points), recent break tracking (keeps last 5 break events), and efficient array management ensure smooth performance across all timeframes and market conditions.
Why Choose Ultimate Market Structure ?
This indicator provides traders with institutional-grade market structure analysis, combining multiple analytical approaches into one comprehensive tool. By identifying key structure levels, imbalance zones, and break patterns with advanced significance scoring, it helps traders understand market dynamics and position themselves for high-probability trade setups in alignment with smart money concepts. The sophisticated trend scoring system and intelligent zone management make it an essential tool for any serious trader looking to decode market structure with precision and confidence.
Higherhighhigherlow
Essa's Indicator 2.0Essa's Indicator V2: Beginner's Guide
This custom TradingView indicator has been designed to help you identify key trading opportunities based on session highs/lows, volatility, and moving averages. Below is a breakdown of the main features:
1. Exponential Moving Averages (EMAs)
Fast EMA (Blue Line): Tracks the short-term market trend (default: 9-period EMA).
Slow EMA (Red Line): Tracks the longer-term market trend (default: 21-period EMA).
You can turn on/off the EMAs using the "Show EMAs" option in the settings.
EMAs help smooth out price action and give a clearer picture of trends. A crossover of the fast EMA above the slow EMA can signal an upward trend, while the reverse may indicate a downward trend.
2. Session Highs and Lows
The indicator tracks price highs and lows for three major trading sessions:
London Session (Red): Highlighted in red. Active between 08:00 and 17:00 (LDN timezone) or 03:00 and 12:00 (NY timezone).
New York Session (Blue): Highlighted in blue. Active between 12:00 and 21:00 (LDN timezone) or 07:00 and 16:00 (NY timezone).
Asia Session (Yellow): Highlighted in yellow. Active between 22:00 and 08:00 (LDN timezone) or 18:00 and 03:00 (NY timezone).
Highs and lows for each session are plotted on the chart as lines. Breakouts from these levels can signal important trading opportunities:
London High/Low: Red lines.
New York High/Low: Blue lines.
Asia High/Low: Yellow lines.
The background color also changes depending on the active session:
London: Light red background.
New York: Light blue background.
Asia: Light yellow background.
3. Breakout Alerts
You can set alerts when the price breaks above or below session highs/lows:
Break Above London High: Alert triggered when the price crosses the London session high.
Break Below London Low: Alert triggered when the price falls below the London session low.
Similar alerts exist for the New York and Asia sessions as well.
4. Volatility-Adjusted EMA
The EMAs in this indicator are adjusted based on volatility (ATR - Average True Range). This allows the EMAs to respond to market conditions more dynamically, giving you more accurate trend readings in volatile markets.
5. ZigZag Feature (Optional)
You can enable the ZigZag feature to help visualize the price action's highs and lows:
ZigZag Lines: Highlight major peaks and troughs in price movements, helping you spot trends more easily.
This is helpful for identifying reversals or trend continuations.
6. Fractal Markers
This indicator uses fractals to mark potential turning points in the market:
Green Triangles (Above the Price): Indicate up fractals (potential reversal points where the price could move upwards).
Red Triangles (Below the Price): Indicate down fractals (potential reversal points where the price could move downwards).
Fractals can be a helpful confirmation tool when identifying entry and exit points.
7. Custom Timezone Options
You can choose between London (LDN) and New York (NY) timezones in the settings to adapt the session times to your trading location. This ensures the session high/low markers are displayed correctly for your trading region.
By default, the New York (NY) timezone is enabled for FXCM charts in the UK.
For BTC charts, you will need to switch to the appropriate time zone manually.
Thanks
Essa