Overview

MACD Trend Cloud with EMA/RSI Filter is an overlay indicator that blends trend direction, momentum bias, and MACD confirmation into a single, easy-to-read chart layout. It plots a trend EMA, wraps it in an ATR-based “cloud” to visualize volatility, colors candles by trend state, and prints Buy/Sell markers only when all active conditions agree.

How It Works

  • Trend EMA (baseline): A configurable EMA (default 20) defines the primary direction.
  • MACD confirmation (always active): MACD is calculated as EMA(fast) − EMA(slow), then compared to its EMA signal line. Bullish power is MACD > Signal; bearish power is MACD < Signal.
  • RSI filter (optional): When enabled, bullish momentum requires RSI > 50 and bearish momentum requires RSI < 50. Additional guards prevent buying when RSI is above the Overbought level and prevent selling when RSI is below the Oversold level.
  • Bar-close confirmation (optional): If enabled, signals are only validated on the closed candle.
  • Duplicate signal prevention: The script avoids printing the same direction twice in a row (it won’t spam consecutive BUYs or SELLs).

What You’ll See on the Chart

  • Trend EMA line that changes color: green when price is above the EMA, red when below.
  • Trend Cloud (toggleable): a volatility envelope built as EMA ± (ATR × Cloud Multiplier), filled green/red based on the current EMA-side state.
  • Buy/Sell signals (toggleable): green triangle below bars for BUY, red triangle above bars for SELL.
  • Bar coloring: subtle tint aligned with the EMA-side trend state.
  • Top-right info panel: EMA status (or OFF), RSI value (or OFF), MACD bull/bear state, MACD signal value, and ATR value.

Indicator Information

Version 1.0
Last Update 21 Feb 2026
Category Momentum & Trend
Compatibility TradingView
Script Pine Script v5