MACD Four Color Histogram with Alerts
- Indicateurs
-
Kazuma Uezono
MQL5 / MQL4 / Pine Script v6 developer and active trader.
Seller on the MQL5 Market (indicators for MT4/MT5).
Services:
- TradingView Pine Script to MT5/MT4 conversion (bar-by-bar matching, with tester report)
- MT4 to MT5 migration - Version: 1.2
- Mise à jour: 9 novembre 2026
MACD Four Color Histogram is a MACD for MetaTrader 5 that uses the same formula and the same look as the built-in MACD on TradingView. It is made for traders who use both platforms and want the MACD on each chart to read the same way.
HOW IT DIFFERS FROM THE MT5 STANDARD MACD
- MT5 standard MACD: the histogram is the MACD line itself, and the signal line is an SMA.
- This indicator: three parts, as on TradingView. MACD line, signal line, and histogram = MACD - signal. The histogram has 4 colors.
WHAT IT SHOWS
- MACD line = MA(price, Fast) - MA(price, Slow)
- Signal line = MA(MACD, Signal)
- Histogram = MACD - Signal, in 4 colors:
above zero and growing / above zero and falling / below zero and rising / below zero and falling
- Zero line (dashed). Set its color to None to hide it.
- EMA or SMA can be chosen separately for the oscillator and for the signal line. The EMA is seeded with the SMA of its first "length" bars, the same way TradingView calculates it.
- 8 price sources: close, open, high, low, hl2, hlc3, ohlc4, hlcc4.
HOW WE CHECKED THE MATCH
- We recalculated the values from TradingView's own price data and compared them with this indicator. The largest difference was 1.3e-15 (floating-point rounding).
- Histogram colors matched on 5,955 of 5,955 bars. SMA settings and the hl2 source matched as well.
- MACD/signal crosses matched the cross condition of TradingView alerts on every bar (5,299 bars of a crypto symbol with very small prices).
- Important: the price data itself differs between brokers and data feeds, so the values on your chart will not be identical to another feed. In our EURUSD H4 comparison, the MACD differed by about 0.5% on average for this reason alone. The formula is the same; the prices are not.
- The EMA also depends on where the chart's history starts. After a few hundred bars this effect becomes negligible.
ALERTS (all off by default)
- MACD crosses the signal line (the histogram changes sign)
- MACD line crosses zero
- Checked on closed bars only, at most once per bar per condition. No alerts are raised for past bars when the indicator is loaded.
- Pop-up, sound and push notification can be switched on separately. Push notifications need your MetaQuotes ID to be set in the terminal.
- Alert text is in English or Japanese, chosen automatically from the terminal language (can be fixed in the inputs).
- An alert only reports that a condition on the indicator has occurred. It is not a buy or sell recommendation.
INPUTS
MACD
- Fast length (12), Slow length (26), Source (close), Signal smoothing (9)
- Oscillator MA type (EMA), Signal line MA type (EMA)
- Lengths must be between 1 and 1000.
Colors
- Histogram: above zero growing / above zero falling / below zero rising / below zero falling
- MACD line, Signal line, Zero line
Alerts
- Alert: MACD crosses signal line (off), Alert: MACD line crosses zero (off)
- Alert by pop-up (on), by sound (off), by push notification (off)
- Alert language (Auto)
NOTES
- Works on every symbol and timeframe.
- Loading time: about 0.6 seconds for around 10 million M1 bars in our test (depends on your PC).
- Closed bars do not repaint. The current bar's values change until the bar closes, as with any MACD.
- No DLLs, no external files, no internet access.
- This is an analysis aid. It does not open trades and does not guarantee any trading result.
- Support covers installation, settings and bug reports.
Part of a series of TradingView-style tools for MT5. Also in the series: RSI AutoScale with Zone Fills. See my seller profile for the other tools.
TradingView is a trademark of TradingView, Inc. This product is not affiliated with or endorsed by TradingView, Inc.
