All indicators

DMA(Displaced Moving Average)

Mar 18, 2019

Static chart image
Support and ResistanceSignalsMoving Averages

The DMA indicator provides a specialized set of three displaced moving averages designed for constructing DiNapoli-style charts to identify trend direction and potential support or resistance levels.

Usage

The Usage section describes how the script can be used to analyze market trends through the lens of Joe DiNapoli’s displacement methodology.

Displaced Moving Averages (DMA) are used differently than standard moving averages. Because the lines are shifted forward in time, they act as a filter for price action. Users typically look for "thrusts" where the price stays on one side of the DMA, indicating a strong trend.

Common applications include:

  • Trend Identification: When price remains above the DMAs, the market is considered in an uptrend. Conversely, price remaining below indicates a downtrend.
  • Crossover Signals: The script includes built-in logic for crossovers between the three different DMAs, which can signal changes in market momentum.
  • Support/Resistance: The displaced lines often act as dynamic reaction levels. Traders often look for specific price patterns, such as the "Bread and Butter" or "Double Penetration" setups described in DiNapoli’s trading techniques, which rely on these specific MA offsets.

Details

The DMA script calculates Simple Moving Averages (SMA) and applies a positive horizontal shift (offset) to the plot. By displacing the moving average forward, the indicator reduces the number of "false" whipsaws that occur when price fluctuates narrowly around a standard moving average.

The default settings are optimized for the DiNapoli approach:

  • 3x3 DMA: A 3-period SMA shifted forward 3 periods.
  • 7x5 DMA: A 7-period SMA shifted forward 5 periods.
  • 25x5 DMA: A 25-period SMA shifted forward 5 periods.

While the script focuses on the moving averages, it is often used in conjunction with a MACD set to (8, 17, 9) to align with the complete DiNapoli trading framework.

Settings

Settings are organized into groups for each of the three moving averages:

MA 1

  • Enable 1st MA: Toggles the visibility of the first displaced moving average.
  • Length: Sets the lookback period for the SMA calculation (Default: 3).
  • Source: Determines the price data used for the calculation (Default: Close).
  • Offset: Sets the number of bars to shift the plot forward in time (Default: 3).

MA 2

  • Enable 2nd MA: Toggles the visibility of the second displaced moving average.
  • Length2: Sets the lookback period for the SMA calculation (Default: 7).
  • Source2: Determines the price data used for the calculation (Default: Close).
  • Offset2: Sets the number of bars to shift the plot forward in time (Default: 5).

MA 3

  • Enable 3rd MA: Toggles the visibility of the third displaced moving average.
  • Length3: Sets the lookback period for the SMA calculation (Default: 25).
  • Source3: Determines the price data used for the calculation (Default: Close).
  • Offset3: Sets the number of bars to shift the plot forward in time (Default: 5).

FAQ

What makes a Displaced Moving Average different from a regular Moving Average? A regular moving average is plotted on the current bar, whereas a Displaced Moving Average is shifted forward by a specified number of bars. This shift helps traders visualize where the trend was relative to current price action, reducing "noise" and providing a clearer trend filter.

Can I use these DMAs on any timeframe? Yes, the DMA tool can be applied to any timeframe; however, the DiNapoli levels were originally popularized for daily and weekly charts to identify major market shifts.

How do I access the DMA indicator? 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.