MS & RSI Divergences

Jun 4, 2026

Static chart image
Support and Resistance
Volume Based
Oscillators
Divergences
Patterns
Pivot Based (Retrospective)

The MS & RSI Divergences indicator provides a comprehensive visual framework for analyzing market structure, momentum exhaustion, and volume distribution by identifying key swings and regular RSI divergences directly on the chart.

Usage

The Usage section describes how the script can be used to interpret price action through automated labels and volume metrics.

Market Structure

The indicator identifies pivot highs and lows to classify market structure. Traders can use these labels to determine the current trend direction:

  • HH (Higher High) / HL (Higher Low): Indicates a bullish trend or continuation.
  • LH (Lower High) / LL (Lower Low): Indicates a bearish trend or continuation.
  • Dotted ZigZag: Visually connects confirmed swings to clarify the market's path.

RSI Divergences

The script identifies regular momentum divergences at confirmed swing points to signal potential exhaustion:

  • Bearish Divergence: Price forms a higher high (HH) while the RSI forms a lower high.
  • Bullish Divergence: Price forms a lower low (LL) while the RSI forms a higher low. These signals are marked with a "D" label and can be used to anticipate potential reversals or pullbacks.

Swing Volume Profile & Statistics

For every completed swing leg, the script can project a volume profile and a Point of Control (POC). This helps identify:

  • High Activity Zones: Areas where the most volume was traded within a specific swing.
  • Leg Stats: Displays total volume and an approximated volume delta (based on candle polarity) to gauge the strength of a price movement.

Details

The indicator uses pivot-based logic requiring a specific number of bars to the left and right for confirmation. Because of this, labels and profiles appear after the Right Bars Lookback period has passed.

The script features a dynamic update mechanism: if a stronger high or lower low appears before an opposite pivot is confirmed, the script updates the active swing to the most extreme valid point. This prevents "cluttered" charts and ensures only the most significant structural levels are maintained. The volume delta is calculated by summing volume from bullish candles as positive and bearish candles as negative within the swing duration.

Settings

Market Structure

  • Left Bars Lookback: The number of bars required to the left of a pivot for it to be considered.
  • Right Bars Lookback: The number of bars required to the right to confirm the pivot (affects signal lag).
  • Show MS Labels: Toggles the visibility of HH, LH, HL, and LL labels.
  • Show Dotted ZigZag: Toggles the connecting line between swings.

RSI Divergence

  • Show Regular Divergences: Enables detection and labeling of RSI divergences.
  • RSI Length: The lookback period for the RSI calculation.
  • Bullish/Bearish Div Color: Customizes the color of divergence lines and "D" labels.

Swing Volume Profile

  • Show Swing Volume Profiles: Toggles the horizontal volume distribution display.
  • Profile Granularity (Rows): Determines how many price bins are used for the profile.
  • Profile Width: Sets how far the volume bars extend to the right.
  • Show Leg Stats: Toggles the text block showing Leg Volume, Delta, and POC price.
  • Background Transparency: Adjusts the visibility of the profile area.

FAQ

How do I access the MS & RSI Divergences? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Why do the labels appear several bars late? The indicator uses pivot confirmation logic. A swing is only confirmed once the "Right Bars Lookback" number of bars has closed without exceeding the pivot price, ensuring the structural point is valid.

Does this indicator repaint? The indicator uses a "strongest swing" logic for the active leg. While it does not repaint historical confirmed pivots, the current active label may move to a more extreme price point until a pivot in the opposite direction is confirmed.

Free access on the following platforms
tradingviewSymbolTradingView
Open in your browser

This in-app browser is not compatible with Get Access from the library.

Tap the menu (...) at the top of your screen and select "Open in Browser", "Open in Safari", or "Open in Chrome" to continue.

ninjatraderNinjaTrader
Open in your browser

This in-app browser is not compatible with Get Access from the library.

Tap the menu (...) at the top of your screen and select "Open in Browser", "Open in Safari", or "Open in Chrome" to continue.

metatrader4MetaTrader 4/5
Open in your browser

This in-app browser is not compatible with Get Access from the library.

Tap the menu (...) at the top of your screen and select "Open in Browser", "Open in Safari", or "Open in Chrome" to continue.

thinkorswimThinkorswim
Open in your browser

This in-app browser is not compatible with Get Access from the library.

Tap the menu (...) at the top of your screen and select "Open in Browser", "Open in Safari", or "Open in Chrome" to continue.

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.