Market Structure
Dec 14, 2024

The Market Structure indicator provides a robust framework for identifying and visualizing price dynamics through non-repainting market structure levels and a comprehensive suite of moving averages. This tool aims to help traders differentiate between local price action and broader market trends across any timeframe or asset class.
Usage
The indicator can be used to identify key pivot points and structural shifts in the market. It categorizes structure into two distinct layers to provide a balanced view of price action:
- Internal Structure (Lighter Lines): Highly sensitive to local price fluctuations, useful for identifying short-term shifts or entries within a larger trend.
- General Structure (Darker Lines): Focuses on broader market context, highlighting major swing points and long-term trend direction.
Traders can use the integrated moving average to confirm trend direction or act as dynamic support and resistance. The "Breakout Threshold" setting allows users to filter out noise, requiring a specific number of consecutive breaks before the general structure adjusts, which is particularly useful in volatile markets.
Details
This script employs a fixed-length lookback period to detect genuine swing points (pivots), ensuring that once a level is identified, it remains permanent. This non-repainting nature provides reliable historical data for backtesting and real-time analysis. The breakout detection logic can be toggled between "Close" price or "High/Low" price, allowing for different sensitivity levels regarding structural breaks. Additionally, an offset feature allows users to shift the structure lines back to the actual swing point for better visual alignment with historical price action.
Settings
Market Structure Settings
- Swing Size: Determines the number of bars used for swing high and swing low detection.
- Use Close Price: When enabled, the script uses the close price for breakout detection; otherwise, it uses high/low prices.
- Breakout Threshold: The number of consecutive structural breaks required before the general structure level is updated.
- Offset Market Structure?: If enabled, offsets the structure lines by the swing size to align with the detected pivot bar.
Moving Average Settings
- Moving Average Type: Select from over 30 different moving average types, including:
- Basic: SMA, EMA, WMA, VWMA.
- Advanced/Adaptive: KAMA (Kaufman), ALMA, FRAMA (Fractal), VIDA.
- Specialized: Hull MA (HMA), ZLEMA, JMA (Jurik), and Ehlers-based filters.
FAQ
How do I access Market Structure?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Does this indicator repaint?
No, the indicator uses a fixed lookback period for pivot detection, making it non-repainting and reliable for historical analysis.
What is the difference between Internal and General structure?
Internal structure captures minor price shifts (local context), while General structure focuses on significant swing points (global context), helping to distinguish between pullbacks and true trend reversals.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.