Market Structure - By Leviathan

Nov 8, 2022

Static chart image
Support and Resistance
Signals
Patterns
Pivot Based (Retrospective)

The Market Structure - By Leviathan indicator provides an automated framework for identifying price action milestones by plotting swing points, market structure breaks, and equilibrium retracement levels.

Usage

The Usage section describes how the script can be used to navigate price action. Traders can utilize the automated labels to identify the current trend phase (bullish, bearish, or ranging) and anticipate potential reversals or continuations.

  • Swing Point Identification: The tool automatically labels Higher Highs (HH), Higher Lows (HL), Lower Highs (LH), and Lower Lows (LL). These labels help traders define the structural trend without manual drawing.
  • Break of Structure (BOS): When price breaches a previous swing point in the direction of the trend, a BOS line is plotted. This signals trend persistence.
  • Change of Character (CHoCH): If enabled, the first counter-trend break is labeled as a CHoCH, providing an early warning of a potential trend shift.
  • 0.5 Retracement Levels: The indicator can plot a horizontal line at the 50% mark of an expansion move (e.g., between an HL and HH). This acts as a "discount" or "premium" equilibrium point where traders often look for entries.

Details

The script utilizes pivot point logic (inspired by BacktestRookies) to determine swing highs and lows based on a user-defined lookback period.

  • Logic Execution: A swing point is confirmed only after a specific number of bars have passed to the right of the high/low, ensuring the point is a local peak or trough.
  • Break Detection: The script monitors price relative to the most recent active swing levels. Depending on user settings, a break is triggered either when a wick touches the level or only when a candle body closes beyond it.
  • Retracement Calculation: The 0.5 level is calculated as the mathematical midpoint between the preceding swing low and the subsequent swing high (in uptrends) or vice versa (in downtrends).

Settings

  • Swing Length: Determines the number of bars required on the left and right to confirm a pivot. Higher values result in more significant, long-term structure, while lower values capture minor fluctuations.
  • BOS Confirmation: Sets the trigger for a structure break. "Candle Close" requires the bar to close past the level for confirmation, whereas "Wicks" triggers the break immediately upon price touch.
  • Show CHoCH: When enabled, the first break against the current trend direction is labeled "CHoCH" instead of "BOS" to highlight trend reversals.
  • Show Swing Points: Toggles the visibility of the HH, LH, HL, and LL labels.

0.5 Retracement Level

  • Show 0.5 Retracement Level: Enables the midpoint line between swing points of an expansion move.
  • Color / Line Style / Width: Customizes the visual appearance of the retracement levels.

BOS Settings

  • Bullish/Bearish BOS Color: Adjusts the color of the horizontal break lines for better visual distinction.
  • Line Style / Width: Customizes the appearance of the BOS and CHoCH lines.

FAQ

How do I adjust the indicator for different timeframes? You should adjust the "Swing Length" setting. Generally, higher timeframes may require smaller lengths to capture relevant moves, while lower timeframes may benefit from larger lengths to filter out market noise.

What is the difference between BOS and CHoCH in this script? A BOS (Break of Structure) refers to a break that continues the current trend. A CHoCH (Change of Character) is the first break that goes against the current trend, signaling a potential reversal.

How can I access the Market Structure - By Leviathan indicator? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free access on the following platforms
tradingviewSymbolTradingView
ninjatraderNinjaTrader
metatrader4MetaTrader 4/5
thinkorswimThinkorswim

Unlock Unlimited Access to the LuxAlgo Library

Upgrade your plan to get all indicators, strategies, charts, and full access to Quant, our AI agent.

Trading & investing are risky and many will lose money in connection with trading and investing activities. All content on this site is not intended to, and should not be, construed as financial advice. Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Past performance does not guarantee future results.

Hypothetical or Simulated performance results have certain limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, including, but not limited to, lack of liquidity. Simulated trading programs in general are designed with the benefit of hindsight, and are based on historical information. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.

As a provider of technical analysis tools and strategies, we do not have access to the personal trading accounts or brokerage statements of our customers. As a result, we have no reason to believe our customers perform better or worse than traders as a whole based on any content, tool, or platform feature we provide.

Charts used on this site are by TradingView in which the majority of our technical indicators are built on. TradingView® is a registered trademark of TradingView, Inc. www.TradingView.com TradingView® has no affiliation with the owner, developer, or provider of the Services described herein.

Market data is provided by CBOE, CME Group, BarChart, Massive, CoinAPI. Select U.S. equities data is provided through Massive. CBOE BZX real-time U.S. equities data is licensed from CBOE and provided through BarChart. Real-time futures data is licensed from CME Group and provided through BarChart. Select cryptocurrency data, including major coins, is provided through CoinAPI. All data is provided “as is” and should be verified independently for trading purposes.

This does not represent our full Disclaimer. Please read our full disclaimer.

© 2026 LuxAlgo Global, LLC.