All indicators

Flexible MACD

Jul 14, 2020

Static chart image
SignalsOscillatorsMoving Averages

The Flexible MACD indicator is a versatile trend-following tool that allows users to customize the moving average types used for the MACD, signal, and histogram calculations to better suit different market conditions. By offering 15 different smoothing methods, it provides a highly adaptable alternative to the standard MACD, helping traders identify momentum shifts and trend reversals with greater precision.

Usage

The Usage section describes how the script can be used to interpret market momentum and trend direction:

  • Trend Identification: When the blue MACD line is above the red signal line, it indicates an upward trend (marked by green circles). Conversely, when the signal line is above the MACD line, a downward trend is indicated (marked by red circles).
  • Crossovers: Traders can look for bullish crossovers (MACD crossing above the signal) or bearish crossunders (MACD crossing below the signal) as potential entry or exit points.
  • Histogram Analysis: The histogram displays the difference between the MACD and signal lines. Rising green bars indicate strengthening bullish momentum, while falling red bars indicate strengthening bearish momentum.
  • Visual Aids: The script includes optional bands that fill the space between the MACD and signal lines, providing a quick visual reference for the current trend state.

Details

The Flexible MACD functions by calculating the difference between a "Fast" moving average and a "Slow" moving average to create the MACD line. A third "Signal" moving average is then applied to the MACD line itself. Unlike the standard version which typically uses Exponential Moving Averages (EMA), this tool allows users to select from a wide array of filters including HMA, KAMA, DEMA, and VIDYA. This flexibility allows for reduced lag or smoother filtering depending on the chosen method.

Settings

MACD: Fast

  • Fast: Smoothing Type: Selects the MA type for the fast component (e.g., EMA, SMA, HMA, etc.).
  • Fast: Period: Sets the lookback period for the fast MA.
  • Fast: Color: Customizes the color of the MACD line.

MACD: Slow

  • Slow: Smoothing Type: Selects the MA type for the slow component.
  • Slow: Period: Sets the lookback period for the slow MA.
  • Slow: Color: Customizes the color of the signal line.

MACD: Signal

  • Signal: Type: Selects the MA type for the signal line calculation.
  • Signal: Period: Sets the smoothing period for the signal line.

Styling

  • Line Width: Adjusts the thickness of the indicator lines and histogram.
  • Bands: On/Off: Toggles the background fill between the MACD and signal lines.
  • Bands: Transparency: Adjusts the visibility of the trend bands.

FAQ

How do I use the different smoothing types?

You can experiment with different MA types in the settings to find a balance between responsiveness and noise reduction. For example, using "HMA" (Hull Moving Average) will typically result in less lag than a standard "SMA".

Can I set alerts for crossovers?

Yes, this indicator includes built-in alert conditions for both Bullish and Bearish crossovers between the MACD and the Signal line.

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.