OPEN-SOURCE SCRIPT

Heikin Ashi + MACD Momentum Filter

130
The Heikin Ashi + MACD Momentum Filter is designed for short-term and swing traders, combining the trend-smoothing capabilities of manually calculated Heikin Ashi candles with the momentum confirmation of the MACD histogram to generate reliable buy and sell signals. This indicator aligns trend direction with momentum shifts to minimize false signals, making it ideal for trading trending markets on timeframes like 5-minute to 1-hour charts.

How It Works
The indicator uses two technical components to produce signals:
  • Heikin Ashi for Trend Detection:
    Heikin Ashi candles are manually calculated to smooth price action, with the close as the average of OHLC values and the open as the average of the previous Heikin Ashi open and close. These values are further smoothed over a default 5-period moving average. A bullish trend is confirmed when the smoothed Heikin Ashi close is above its open (plotted in green), and a bearish trend when the close is below the open (plotted in red). This smoothing reduces noise, helping traders stay in the direction of the prevailing trend.

  • MACD Histogram for Momentum Confirmation:
    The MACD, calculated with standard settings (fast=12, slow=26, signal=9), produces a histogram. A buy signal requires the histogram to cross above a threshold (default: 0.0), indicating bullish momentum, while a sell signal requires a cross below, indicating bearish momentum. This ensures trades are taken when momentum supports the trend.

Signal Generation
Signals are generated using the previous bar’s values to prevent repainting:
  • Buy Signal: The MACD histogram crosses above the threshold, and the Heikin Ashi confirms a bullish trend. Displayed as a green upward triangle below the bar.

  • Sell Signal: The MACD histogram crosses below the threshold, and the Heikin Ashi confirms a bearish trend. Displayed as a red downward triangle above the bar.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.