All indicators

Flat & Trend MACD

Jul 22, 2023

Static chart image
SignalsChannelsDashboardMoving Averages

The Flat & Trend MACD indicator provides a visual interpretation of trend momentum and market consolidation directly on the price chart by utilizing a specialized MACD-based algorithm. It helps traders distinguish between strong directional trends and periods of uncertainty or "flat" market conditions.

Usage

The tool overlays a price channel on the chart, with the background color indicating the current trend direction based on the MACD histogram.

  • Trend Identification: A green background and triangle signal a bullish trend (MACD histogram is positive and above the uncertainty threshold). A red background and triangle signal a bearish trend (MACD histogram is negative and below the uncertainty threshold).
  • Flat Zones: When the MACD histogram falls within the "uncertainty zone" (less than 50% of its average deviation over a 50-period lookback), the indicator identifies a flat market. If enabled, the background color lightens and an on-screen dashboard warns of a flat zone.
  • UP/DN Moves: Optional small triangles can be enabled to highlight shorter-term momentum shifts where the MACD line crosses the signal line within bullish or bearish territory.
  • Information Dashboard: A table in the top-right corner displays the current ticker, timeframe, and specific trend status, including active warnings for consolidation phases.

Details

The core logic relies on the MACD histogram's relationship with a dynamically calculated "uncertainty zone." This zone is defined as 50% of the maximum absolute value of the histogram over the last 50 bars. By requiring the histogram to break outside this range to confirm a trend change, the indicator filters out minor fluctuations and false signals often found in standard MACD crossovers. The price channel (High-line and Low-line) is calculated based on the highest high and lowest low of the user-defined Fast Length period.

Settings

MACD Settings

  • Fast: The length for the fast EMA calculation (standard is 12).
  • Slow: The length for the slow EMA calculation (standard is 26).
  • Smooth: The smoothing period for the MACD signal line (standard is 9).
  • Source: The price data source used for calculations (e.g., Close).
  • Show flat zones: Toggles the visualization of market consolidation periods.
  • Show UP/DN moves: Toggles the display of minor momentum shifts (crosses of MACD and signal line).

Automatic Alerts

  • Change trend: Enables alerts when the indicator detects a shift from bullish to bearish or vice-versa.
  • Flat zone: Enables alerts when the market enters a consolidation phase.
  • UP move / DN move: Enables alerts for specific momentum signals and their respective closures.

FAQ

How do I access the Flat & Trend MACD?

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

Can I use this for intraday trading?

Yes, the indicator is designed to be compatible with any instrument and any timeframe, including intraday charts.

How does the flat zone filter help my trading?

By identifying "uncertainty zones" where momentum is low, the script helps you avoid taking positions during sideways markets, which often lead to "whipsaw" losses in trend-following strategies.

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.