OPEN-SOURCE SCRIPT

Market Structure Oscillator [LuxAlgo]

By LuxAlgo
Wizard
The Market Structure Oscillator indicator analyzes and synthesizes short-term, intermediate-term, and long-term market structure shifts and breaks, visualizing the output as oscillators and graphical representations of real-time market structures on the main price chart.

The oscillator presentation of the detected market structures helps traders visualize trend momentum and strength, identifying potential trend reversals, and providing different perspectives to enhance the analysis of classic market structures.

🔶 USAGE

snapshot

A market structure shift signals a potential change in market sentiment or direction, while a break of structure indicates a continuation of the current trend. Detecting these events in real-time helps traders recognize both trend changes and continuations. The market structure oscillator translates these concepts visually, offering deeper insights into market momentum and strength. It aids traders in identifying overbought or oversold conditions, potential trend reversals, and confirming trend direction.

snapshot

Oscillators often generate signals based on crossing certain thresholds or diverging from price movements, providing cues for traders to enter or exit positions.

snapshot

The weights determine the influence of each period (short-term, intermediate-term, long-term) on the final oscillator value. By changing the weights, traders can emphasize or de-emphasize the importance of each period. Higher weights increase their respective market structure's influence on the oscillator value. For example, if the weight for the short-term period is set to 0, the final value of the oscillator will be calculated using only the intermediate-term and long-term market structures.

snapshot

The indicator features a Cycle Oscillator component, which uses the market structure oscillator values to generate a histogram and provide further insights into market cycles and potential signals. The Cycle Oscillator aids in timing by allowing traders to more easily see the median length of an oscillation around the average point, helping them identify both favorable prices and favorable moments for trading.

snapshot

Users can also display detected market structures on the price chart by enabling the corresponding market structure toggle from the "Market Structures on Chart" settings group.

🔶 DETAILS

The script initiates its analysis by detecting swing levels, which form the fundamental basis for its operations. It begins by identifying short-term swing points, automatically detected solely based on market movements without any reliance on user-defined input. Short-Term Swing Highs (STH) are peaks in price surrounded by lower highs on both sides, while Short-Term Swing Lows (STL) are troughs surrounded by higher lows.

To identify intermediate-term and long-term swing points, the script uses previously detected short-term swing points as reference points. It examines these points to determine intermediate-term swings and further analyzes intermediate-term swings to identify long-term swing points. This method ensures a thorough and unbiased evaluation of market dynamics, providing traders with reliable insights into market structures.

snapshot

Once swing levels are detected, the process continues with the analysis of Market Structure Shifts (MSS) and Breaks of Structure (BoS). A Market Structure Shift, also known as a Change of Character (CHoCH), is a critical event in price action analysis that suggests a potential shift in market sentiment or direction. It occurs when the price reverses from an established trend, indicating that the current trend may be losing momentum and a reversal could be imminent.

On the other hand, a Break of Structure signifies the continuation of the existing market trend. This event occurs when the price decisively moves beyond a previous swing high or low, confirming the strength and persistence of the prevailing trend.

The indicator analyzes price patterns using a pure price action approach and identifies market structures for short-term, intermediate-term, and long-term periods. The collected data is then normalized and combined using specified weights to calculate the final Market Structure Oscillator value.

snapshot

🔶 SETTINGS

The indicator incorporates user-defined settings, allowing users to tailor it according to their preferences and trading strategies.

🔹 Market Structure Oscillator

  • Market Structure Oscillator: Toggles the visibility of the market structures oscillator.
  • Short Term Weight: Defines the weight for the short-term market structure.
  • Intermediate Term Weight: Defines the weight for the intermediate-term market structure.
  • Long Term Weight: Defines the weight for the long-term market structure.
  • Oscillator Smoothing: Determines the smoothing factor for the oscillator.
  • Gradient Colors: Allows customization of bullish and bearish gradient colors.
  • Market Structure Oscillator Crosses: Provides signals based on market structure oscillator equilibrium level crosses.


🔹 Cycle Oscillator

  • Cycle Oscillator - Histogram: Toggles the visibility of the cycle oscillator.
  • Cycle Signal Length: Defines the length of the cycle signal.
  • Cycle Oscillator Crosses: Provides signals based on cycle oscillator crosses.


🔹 Market Structures on Chart

  • Market Structures: Allows plotting of market structures (short, intermediate, and long term) on the chart.
  • Line, Label, and Color: Options to display lines and labels for different market structures with customizable colors.


🔹 Oscillator Components

  • Oscillators: Separately plots short-term, intermediate-term, and long-term oscillators. Provides options to display these oscillators with customizable colors.


🔶 RELATED SCRIPTS

Market-Structures-(Intrabar)
BOSchochictluxalgomarketstructureOscillatorsPivot points and levelssignalssupportandresitanceTrend Analysis
LuxAlgo
Wizard
Get access to our exclusive tools: luxalgo.com

Join our 150k+ community: discord.gg/lux

All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer