All indicators

MacD Custom Indicator (updated to version 4)

Mar 4, 2021

Static chart image
SignalsOscillatorsMoving Averages

The MacD Custom Indicator tool provides a highly customizable version of the classic MACD oscillator with multi-timeframe capabilities and enhanced visual feedback. It aims to help traders identify momentum shifts, trend direction, and potential entry/exit points by offering granular control over the display of the MACD line, signal line, and histogram.

Usage

The indicator can be used to identify trend changes through crossovers and histogram fluctuations. Users can toggle specific visual elements to suit their strategy:

  • Crossover Detection: Enable dots to appear exactly when the MACD line crosses the signal line for clear entry or exit signals.
  • Histogram Interpretation: Use the 4-color histogram mode to distinguish between strengthening and weakening momentum above and below the zero line.
  • Multi-Timeframe Analysis: Analyze higher timeframe momentum (e.g., 1-hour MACD) while trading on a lower timeframe chart (e.g., 5-minute) to ensure alignment with the broader trend.

Details

This script is a modernized version of the classic MACD implementation, originally conceptualized by ChrisMoody. It calculates the difference between a fast and slow Exponential Moving Average (EMA) to create the MACD line, then applies a Simple Moving Average (SMA) to that line to create the Signal line. The histogram represents the distance between these two values. The multi-timeframe functionality uses the request.security function to fetch data from different resolutions, allowing for top-down analysis within a single pane.

Settings

  • Use Current Chart Resolution?: When enabled, the indicator uses the timeframe of the current chart.
  • Use Different Timeframe?: Allows selecting a specific timeframe (e.g., 60 minutes) if the "Use Current Chart Resolution" box is unchecked.
  • Show MacD & Signal Line?: Toggles the visibility of the MACD and Signal lines.
  • Show Dots When MacD Crosses Signal Line?: Displays a circle at the point of intersection between the MACD and Signal lines.
  • Show Histogram?: Toggles the visibility of the MACD histogram.
  • Change MacD Line Color-Signal Line Cross?: Automatically changes the MACD line color based on whether it is above or below the signal line.
  • MacD Histogram 4 Colors?: Enables a nuanced color scheme for the histogram to show increasing/decreasing momentum.
  • Fast/Slow/Signal Length: Adjusts the lookback periods for the moving average calculations.

FAQ

How do I change the timeframe of the MACD?

You can uncheck the "Use Current Chart Resolution?" box in the settings and then select your desired timeframe from the "Use Different Timeframe?" dropdown menu.

What do the four histogram colors represent?

The colors indicate whether the histogram is rising or falling relative to the previous bar, as well as whether it is currently above or below the zero line, providing a more detailed view of momentum strength.

How can I access this tool?

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.