All indicators

ADX and DI EMA Trend Line

Aug 31, 2021

Static chart image
CandlestickMoving AveragesPatternsVolatility

The ADX and DI EMA Trend Line indicator provides a comprehensive trend-following toolkit that integrates directional movement, trend strength, and moving averages directly onto the price chart to identify high-probability momentum shifts. By combining the Average Directional Index (ADX) and Directional Indicators (DI) with Exponential Moving Averages (EMA), the tool visualizes trend transitions and volatility patterns through dynamic line coloring and bar highlighting.

Usage

The Usage section describes how the script can be used to interpret market momentum and structural shifts. The indicator functions as a multi-layered trend analysis system:

  • Directional EMA Coloring: The 50 EMA acts as a primary baseline for bull/bear transitions. The script colors the EMA based on the DI relationship: green when +DI is above -DI (bullish), red when -DI is above +DI (bearish), and the default chart color when no clear direction is established.
  • Momentum Visualization: The 9 EMA (or VWAP depending on settings) reflects the ADX rate of change. A bright blue line indicates an increasing ADX (strengthening trend), while a faded blue line indicates a decreasing ADX (weakening trend).
  • Price Action Patterns: The tool automatically highlights specific bar formations. Inside bars and outside bars are color-coded to alert traders to potential volatility contraction or expansion.
  • Advanced Patterns: It identifies "Holy Grail" (Outside bar followed by an Inside bar) and "Inverse Grail" patterns, which often precede significant breakouts or reversals.

Details

The script calculates the Directional Movement Index (DMI) using J. Welles Wilder’s original methodology, utilizing the Relative Moving Average (RMA) of the True Range.

The core logic separates trend direction from trend strength. The DI +/- calculation determines the color of the 9 EMA, signaling whether buyers or sellers are in control. Simultaneously, the Rate of Change (ROC) of the ADX is calculated to determine if that trend is gaining or losing velocity. By overlaying these metrics on EMAs rather than a separate oscillator window, traders can observe the interaction between momentum and price levels (like the 50 EMA) in real-time.

Settings

  • DI Length: Sets the lookback period for calculating the +DI and -DI values.
  • ADX Smoothing: Adjusts the smoothing period for the Average Directional Index calculation.
  • ADX MA Active: The threshold level above which the ADX must reside for the trend coloring to become active.
  • Length (50): The period used for the primary trend-tracking EMA.
  • Length (9): The period used for the momentum-tracking EMA.
  • Source: Determines the price data (Close, Open, High, Low, etc.) used for the calculations.

FAQ

How do I interpret the different line colors?

The 9 EMA turns green when the positive directional index (+DI) is dominant and red when the negative directional index (-DI) is dominant. The ADX-based line turns bright blue when momentum is increasing and fades when momentum is stalling.

What are the "Holy Grail" patterns?

A Holy Grail pattern occurs when an Outside Bar (volatility expansion) is immediately followed by an Inside Bar (volatility contraction). This often suggests the market is "coiling" for a significant move.

How can I access the ADX and DI EMA Trend Line?

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.