All indicators

MACD & RSI+Stoch + Divergences

Jan 7, 2020

Static chart image
Price Action BasedSignalsOscillatorsDivergencesMoving AveragesPatternsPivot Based (Retrospective)

The MACD & RSI+Stoch + Divergences indicator provides a multi-functional oscillator tool that identifies regular and hidden divergences across multiple technical indicators. It streamlines technical analysis by allowing users to switch between RSI, Stochastic RSI, and MACD (including Histogram) while automatically plotting divergence lines and signals directly on the oscillator pane.

Usage

This tool can be used to identify potential trend reversals (regular divergences) or trend continuations (hidden divergences). By selecting the desired oscillator from the settings, users can monitor market momentum and price action discrepancies.

  • RSI Mode: Useful for identifying overbought/oversold conditions and classic momentum divergences.
  • Stochastic RSI Mode: Provides a more sensitive oscillator for quick momentum shifts.
  • MACD & Histogram Mode: Focuses on moving average convergence/divergence, ideal for identifying shifts in trend strength.
  • Visual Signals: The indicator plots lines connecting oscillator peaks/troughs. Bullish signals appear below the oscillator, while bearish signals appear above. Users can toggle between labels, arrows, or various shapes for these signals.

Details

The script uses a complex calculation method to identify pivot points and verify that price action has not "broken" the trend line between two points before confirming a divergence. It employs a customizable lookback period and pivot point logic (left/right bars) to filter out noise.

A significant feature is the max_bars_back implementation (set to 5000), which ensures the script has enough historical data for its heavy calculations. To maintain performance, the script includes an "only last" filter to limit processing to the most recent bars.

Settings

Main Settings

  • Source [high - low]: Defines the price source used for high and low pivot detection (e.g., High/Low, Close, or Max/Min Open-Close).
  • Left: The number of bars to the left of a point required to confirm a pivot.
  • Bullish/Bearish Regular/Hidden DIV: Toggles for specific types of divergences and their associated colors.
  • Show: Dropdown menu to select the active oscillator (RSI, Stoch, MACD, or Histogram).
  • Source: The price source for the oscillator calculations (default is Close).

Oscillator Parameters

  • rsi: Period for the Relative Strength Index.
  • stoch: Length for Stochastic calculation along with K and D smoothing periods.
  • macd: Fast, slow, and signal lengths for the MACD calculation.

Lookback & Visuals

  • Lookback: The maximum length (in bars) allowed for a divergence line.
  • Only last: Limits calculation to the specified number of recent bars to improve performance.
  • Left osc point must be a Pivot Point: When enabled, the starting point of the oscillator divergence must be a confirmed pivot.
  • Show Lines / Show Arrows: Toggles the visibility of trend lines and signal markers.
  • Style / Label Size: Customizes the shape and size of the divergence alerts.

FAQ

How do I switch between RSI and MACD?

You can change the active oscillator by going into the script settings and adjusting the "Show" dropdown menu under the Settings group.

What is the difference between Regular and Hidden Divergences?

Regular divergences typically suggest a potential trend reversal, while hidden divergences often indicate trend continuation.

How can I get access to MACD & RSI+Stoch + Divergences?

You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.