All indicators

MACD oscillator with EMA strategy 4H

Apr 8, 2021

Static chart image
SignalsOscillatorsTime BasedMoving Averages

The MACD oscillator with EMA strategy 4H tool provides a systematic approach to trend-following by combining momentum filtering with moving average baselines. It aims to capture mid-term trends on the 4-hour timeframe by aligning price action, EMA direction, and MACD histogram shifts.

Usage

The strategy is primarily designed for the 4-hour timeframe but can be adapted to other intervals and asset classes like crypto, forex, and indices. It identifies entry points based on the confluence of three main factors: price relation to the EMA, the direction of the EMA itself, and the state of the MACD histogram.

  • Long Entries: Occur when the price is above the EMA, the EMA is sloping upward, and the MACD histogram crosses above zero while the current candle closes higher than the previous one.
  • Short Entries/Exits: Occur when the price falls below the EMA, the EMA slopes downward, and the MACD histogram crosses below zero while the current candle closes lower than the previous one.

Users can enable Heikin Ashi calculations to smooth out price noise, which may help in trending markets to avoid premature exits.

Details

The script executes logic based on trend confirmation. By requiring the MACD histogram to flip polarity while price is on the correct side of the EMA, it filters out many "fakeout" crosses that occur during choppy sideways price action. The inclusion of the EMA slope (out > out[1]) ensures that the strategy only enters when there is active directional momentum in the moving average baseline.

The strategy also includes a customizable backtesting window, allowing users to define specific start and end dates to analyze performance over particular market cycles.

Settings

  • Use Heikin Ashi Candles in Algo Calculations: Toggles whether the strategy logic uses Heikin Ashi price data or standard candlestick data.
  • Backtesting Window (From/To): Sets the date range for the strategy's active execution.
  • EMA Length: Determines the period for the baseline Exponential Moving Average.
  • Source: The price input used for calculations (default is hl2).
  • MACD Parameters: Includes Fast Length, Slow Length, and Signal Smoothing to customize the oscillator's sensitivity.
  • Simple MA (Oscillator/Signal): Allows users to switch the MACD and Signal line calculations from EMA to SMA.
  • Allow Long/Short Entries: Toggles for enabling specific trade directions.

FAQ

How do I use the MACD oscillator with EMA strategy 4H?

Apply the strategy to a 4-hour chart and ensure the EMA and MACD settings align with your preferred asset's volatility.

Can this be used for intraday trading?

While optimized for the 4H timeframe, you can adjust the EMA and MACD lengths in the settings to suit lower timeframes like 15m or 1H.

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.