OPEN-SOURCE SCRIPT
Heikin-Ashi Trend Matrix [HTM]

Heikin-Ashi Trend Matrix (HTM) uses smoothed Heikin-Ashi calculations combined with a multi-EMA ribbon and ADX filtering to produce a confluence-based scoring system for trend identification and signal generation.

**Mathematical Foundation:**
Heikin-Ashi candles are synthetic candles calculated using averaged formulas: HA-Close = (O+H+L+C)/4, HA-Open = (previous HA-Open + previous HA-Close)/2. These averaged candles naturally smooth price action and make trend direction more visually apparent. HTM applies a secondary smoothing layer (EMA, SMA, or WMA selectable) to the HA values, further reducing noise while preserving trend structure.

The trend matrix evaluates six independent conditions and assigns a point for each: (1) smoothed HA candle direction, (2) price vs fast EMA, (3) fast EMA vs medium EMA alignment, (4) medium EMA vs slow EMA alignment, (5) price vs 200 EMA for long-term trend, and (6) DI+ vs DI- from the ADX system. The total score ranges from 0 to 6 for each direction.
**Signal Logic:**
Signals are generated only when the bullish or bearish score reaches a configurable threshold (default 4 of 6) AND ADX confirms a trending market. This multi-condition confluence approach filters out signals in choppy or low-momentum environments. Signals fire on the first bar where the score threshold is met.
**Features:**
- Smoothed Heikin-Ashi with selectable smoothing type (EMA/SMA/WMA)
- Triple EMA ribbon (fast/medium/slow) with fill coloring
- 200 EMA long-term trend reference
- 6-point confluence scoring system
- ADX trend strength gate
- Dual take-profit levels (TP1/TP2) with ATR-based calculation
- Visual score display with filled/empty dot notation
- Optional bar coloring based on signal strength
**Mathematical Foundation:**
Heikin-Ashi candles are synthetic candles calculated using averaged formulas: HA-Close = (O+H+L+C)/4, HA-Open = (previous HA-Open + previous HA-Close)/2. These averaged candles naturally smooth price action and make trend direction more visually apparent. HTM applies a secondary smoothing layer (EMA, SMA, or WMA selectable) to the HA values, further reducing noise while preserving trend structure.
The trend matrix evaluates six independent conditions and assigns a point for each: (1) smoothed HA candle direction, (2) price vs fast EMA, (3) fast EMA vs medium EMA alignment, (4) medium EMA vs slow EMA alignment, (5) price vs 200 EMA for long-term trend, and (6) DI+ vs DI- from the ADX system. The total score ranges from 0 to 6 for each direction.
**Signal Logic:**
Signals are generated only when the bullish or bearish score reaches a configurable threshold (default 4 of 6) AND ADX confirms a trending market. This multi-condition confluence approach filters out signals in choppy or low-momentum environments. Signals fire on the first bar where the score threshold is met.
**Features:**
- Smoothed Heikin-Ashi with selectable smoothing type (EMA/SMA/WMA)
- Triple EMA ribbon (fast/medium/slow) with fill coloring
- 200 EMA long-term trend reference
- 6-point confluence scoring system
- ADX trend strength gate
- Dual take-profit levels (TP1/TP2) with ATR-based calculation
- Visual score display with filled/empty dot notation
- Optional bar coloring based on signal strength
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.