Macd Divergence + MTF EMA
Sep 10, 2021

The Macd Divergence + MTF EMA indicator provides a comprehensive trend-following and reversal strategy by combining Multi-Timeframe (MTF) Exponential Moving Averages (EMA) with MACD histogram divergence detection.
Usage
The indicator is designed to identify high-probability entries by aligning momentum reversals with the underlying trend direction.
- Trend Filtering: The script uses two EMAs from different timeframes to establish trend bias. When the Fast EMA (shorter timeframe) is above the Slow EMA (longer timeframe), the system looks exclusively for long opportunities. Conversely, it looks for shorts when the Fast EMA is below the Slow EMA.
- Divergence Entries: Once the trend is established, the script monitors the MACD histogram for divergences against price action. A bullish entry is triggered when a bullish divergence occurs during an uptrend, while a bearish entry is triggered when a bearish divergence occurs during a downtrend.
- Trade Management: The tool includes built-in risk management features, such as trailing stop losses based on swing points and profit targets calculated using a configurable multiplier.
Details
This tool integrates multiple technical analysis concepts to reduce false signals:
- Multi-Timeframe Analysis: By fetching EMA data from higher resolutions (e.g., 15m and 1h), the indicator ensures that shorter-term entries are supported by broader market structures.
- MACD Divergence: The logic identifies discrepancies between price peaks/valleys and MACD histogram peaks/valleys, suggesting potential exhaustion in the current move.
- Optional Filter: An additional "Filter EMA" (defaulting to a Daily resolution) can be enabled to ensure trades are only taken in the direction of the long-term macro trend.
Settings
EMAS Settings
- Fast EMA: Sets the timeframe and length for the faster MTF EMA.
- Slow EMA: Sets the timeframe and length for the slower MTF EMA.
Filter Settings
- Enable a Third Ema filter?: Toggles an additional long-term trend filter.
- Filter EMA Period: Sets the length of the macro filter EMA.
- Filter Resolution EMA: Sets the timeframe for the macro filter EMA.
MACD Properties
- MACD TimeFrame: Determines the resolution for MACD calculations.
- Fast/Slow/Sign Length: Standard parameters for the MACD oscillator.
Trade Management
- Lookback period: Number of candles used to identify swing highs and lows for stop loss placement.
- Profit Multiplier: Sets the Take Profit target as a multiple of the initial risk.
- Stop Loss Percentage: Fine-tunes the stop loss distance for long and short positions.
FAQ
How do I use the MACD Divergence + MTF EMA?
You can use it to identify trend-aligned reversals. Look for the "Long Trade" or "Short Trade" labels on your chart which indicate when the MTF EMA trend and MACD divergence conditions are met simultaneously.
Can I change the timeframes used for the filters?
Yes, the indicator allows you to customize the resolutions for both the trend EMAs and the MACD calculation within the settings menu to suit different trading styles.
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.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.