Market Structure
Nov 23, 2019

The Market Structure indicator plots horizontal levels at key market turning points to identify potential support and resistance areas based on higher timeframe price action. It helps traders visualize structural shifts where price breaks above or below significant levels, indicating potential trend changes or continuation opportunities.
Usage
The Market Structure tool is used to identify pivot points on a user-defined timeframe. When a bullish or bearish structure is detected, the script plots extended horizontal lines on the chart.
- Bullish Structure: Indicated by green lines, these occur when the previous candle's close is lower than its open, but the current candle closes higher than that previous close.
- Bearish Structure: Indicated by red lines, these occur when the previous candle's close is higher than its open, but the current candle closes lower than that previous close.
Traders often look for price to react to these extended lines as potential zones for entries, stops, or targets.
Details
The script utilizes the request.security() function to pull open and close data from a specified higher timeframe (defaulting to Weekly). The logic identifies "turning points" by comparing the relationship between the previous candle's body and the current candle's closing price.
- A Bearish Structure is confirmed if the previous candle was bullish (
open < close) and the current candle closes below that previous close. - A Bullish Structure is confirmed if the previous candle was bearish (
open > close) and the current candle closes above that previous close.
When these conditions are met, the script draws horizontal lines across the chart using line.new, providing a permanent visual reference for these historical structure points.
Settings
- Market Structure Time Frame: Defines the timeframe from which the open and close data is pulled to determine market structure (e.g., Weekly, Daily, 4-hour).
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.
Can I use this on any timeframe?
Yes, you can apply the indicator to any chart timeframe, but the levels generated will be based on the "Market Structure Time Frame" selected in the settings.
What do the red and green lines signify?
Red lines indicate bearish market structure shifts, while green lines indicate bullish market structure shifts based on the candle close logic described in the Details section.
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.