Skip to content
MT5MT4soonTradingViewsooncTradersoonNinjaTradersoonPythonsoon
IndicatorOscillators & momentumMT5No repaint

MACD

Free MACD indicator for MT5: MACD/signal lines, histogram, closed-bar cross arrows, divergence and HTF panel. Lab repaint test: 0 of 899 signals changed.

Add to a kit
CompareRequest a variant
Embed
MACD on XAUUSD M15, MT5 chart with default settings: macd histogram, macd line, signal line
Screenshots from a real MT5 chart · 9 · scroll sideways
MACD inputs window in MetaTrader 5 with the default settings
MACD inputs window in MetaTrader 5 with the default settings
MACD Signal Cross Down arrow on XAUUSD M15, 28 Oct 2026 16:45
MACD Signal Cross Down arrow on XAUUSD M15, 28 Oct 2026 16:45
MACD MACD Divergence arrow on XAUUSD M15, 28 Oct 2026 03:00
MACD MACD Divergence arrow on XAUUSD M15, 28 Oct 2026 03:00
MACD Signal Cross Up arrow on XAUUSD M15, 27 Oct 2026 12:45
MACD Signal Cross Up arrow on XAUUSD M15, 27 Oct 2026 12:45
MACD on XAUUSD H4 (another timeframe)
MACD on XAUUSD H4 (another timeframe)
MACD on XAUUSD M5 (another timeframe)
MACD on XAUUSD M5 (another timeframe)
MACD on-chart panel: last signal and status
MACD on-chart panel: last signal and status
MACD on EURUSD M15
MACD on EURUSD M15
MACD zoomed out on XAUUSD M15: several weeks of history
MACD zoomed out on XAUUSD M15: several weeks of history
Test verdictPassed
Repainted
0 / 899
Signals / week
—
Tested on
EURUSD M15
Tested
2026-10-09
Download free · Google DriveFree account needed · sign in with Google in one clickFree — share it freely. Just don’t sell, crack or modify it. Licencev1.00 · 143.8 KB · .ex5
Lab pick — built by the lab, not from a member request. Want something like it? Request a tool

Overview

This MACD indicator for MT5 draws the MACD line, the signal line and a green/red histogram in a separate window below your price chart. It adds arrows when the two lines cross on a closed bar, flags basic divergence and shows a regime panel. In the Lab's repaint test, 0 of 899 logged signals changed after they appeared. It helps traders who use MACD crosses to time entries and want the higher-timeframe picture next to each signal.

What MACD measures

MACD is the gap between a fast and a slow EMA; its signal line is an EMA of that gap.

What it draws

  • MACD Histogram: MACD minus signal. It is green when the MACD line is above the signal line and red when it is below.
  • MACD Line and Signal Line: the two lines whose crosses create the arrows.
  • Signal Cross Up / Signal Cross Down arrows: placed in the MACD window on the closed bar where the MACD line moves from at or below the signal line to above it, or the reverse.
  • MACD Divergence mark: price makes a higher swing high (or lower swing low) than the previous swing within MaxDivergenceLookback bars, while MACD at that swing is lower (or higher).
  • Regime panel: the last signal cross with bars ago and strength, the regime, the histogram, MACD and signal values, the zero bias with bars since the last zero cross, the last divergence and the higher-timeframe regime.

How the Lab tested it

The Lab tested version 1.00 (143.8 KB) on MT5 build 6230 on 2026-10-09. It replayed EURUSD M15 from 2026-07-09 to 2026-10-08 on Raw Trading Ltd real ticks. It logged every signal when it appeared and then checked whether any signal later moved or disappeared.

  • 899 signals logged, 0 changed: an arrow on a closed bar stays where it is. The history you scroll back through is what you would have seen live, so you can judge the tool from past charts.
  • Maximum arrow delay: 0 bars: each arrow appeared on the bar where its condition was met and never moved afterwards. Divergence marks are confirmed PivotLookback bars after the swing by design (see How it works). That is a fixed wait, not a redraw.

How it works

  1. 1
    Builds fast and slow exponential moving averages of the chosen price, each seeded with a simple average.EMA = Price x k + EMA_prev x (1 - k), k = 2 / (Period + 1)Inputs: FastEMA, SlowEMA, AppliedPrice
  2. 2
    MACD is fast minus slow, signal is an EMA of MACD, histogram is MACD minus signal.MACD = Fast EMA - Slow EMA, Histogram = MACD - SignalInputs: SignalPeriod, ShowHistogram
  3. 3
    Marks buy when MACD crosses above the signal line and sell when it crosses below. Also notes zero-line crosses.Buy: MACD_prev <= Signal_prev and MACD > SignalInputs: ShowCrossArrows, AlertOnCross, AlertOnZeroCross
  4. 4
    Finds price swing highs and lows, and flags divergence when price makes a new extreme but MACD does not.Bearish: higher price high with lower MACD at the swingInputs: EnableDivergence, PivotLookback, MaxDivergenceLookback
  5. 5
    Reads higher-timeframe MACD and classifies it bull or bear, strong or weak, from MACD sign and signal position.Inputs: ShowHTFBias, HTFTimeframe

Specifications

Platform
MetaTrader 5
Version
1.00
Type
Indicator
Window
Separate window
Draws
1 histo, 2 lines, 3 arrows, 1 panel
Alerts
popup, push, sound
Repaints
No (0 of 899 signals changed)
Inputs
23
Tested on
MT5 build 6230 · 2026-10-09

Repaint test

Signals logged live
899
Changed after close
0
Arrow delay
None

No repaint detected. In a 9 Jul 2026 – 8 Oct 2026 test on EURUSD M15 (Raw Trading Ltd real ticks), 899 signals were logged at bar close and re-read at the end of the test: 0 changed. Arrows print on the bar that closes the signal, with no delay.

IndicatorFree — tested 2026-10-09 · MT5 build 6230 · Raw Trading Ltd real ticks. Results come from historical data, not live trading, and do not guarantee future results.

What it draws

  • A histogram (MACD Histogram) in a separate window.
  • A line (MACD Line) from buffer 2.
  • A line (Signal Line) from buffer 3.
  • Arrows (Signal Cross Up) from buffer 4, drawn on the closed bar.
  • Arrows (Signal Cross Down) from buffer 5, drawn on the closed bar.
  • Arrows (MACD Divergence) from buffer 6, drawn on the closed bar.
  • An on-chart panel (Regime); values shown in the panel are not exposed as buffers.

Inputs

InputDefaultWhat it does
FastEMA12Fast EMA period (2-100)
SlowEMA26Slow EMA period (3-200)
SignalPeriod9EMA period of the signal line, applied to the MACD line (2-100)
AppliedPriceClosePrice used by the fast and slow EMAs
ShowHistogramtrueDraw the MACD - Signal histogram
ShowCrossArrowstrueDraw arrows where MACD crosses its signal line on a closed bar
ShowDashboardtrueShow the on-chart status panel
PanelScale1Panel size multiplier (DPI is applied automatically)
ThemeDarkChart color theme
RestoreThemetrueRestore the original chart colors when removed
EnableDivergencetrueDetect basic divergence between price swings and MACD
PivotLookback2Bars on each side to confirm a swing; the mark appears this many bars late (1-10)
MaxDivergenceLookback100Max bars between the two swings compared for divergence (20-300)
ShowHTFBiastrueShow the regime of a higher timeframe in the panel
HTFTimeframeH4Higher timeframe (row hidden if not above the chart timeframe)
EnableAlertsfalseMaster switch for all alerts
AlertOnCrosstrueAlert on a new closed-bar MACD / signal cross
AlertOnZeroCrossfalseAlert when MACD changes sign across zero on a closed bar
AlertOnDivergencetrueAlert when a new divergence is confirmed
AlertPopuptruePopup alert
AlertPushfalsePush notification
AlertSoundfalseSound alert
AlertSoundFilealert.wavSound file played on alert

How to read it

Install: copy the file into MQL5\Indicators in your MT5 data folder, refresh the Navigator and drag MACD onto a chart.

Reading the histogram and the cross arrows

Every cross follows the same pattern. The histogram shrinks toward zero, changes colour, and the arrow prints on the first closed bar on the other side. The figure shows that pattern.

Illustration of a typical signal: the histogram flips and the cross arrows printIllustration
MACD Histogram (MACD minZero: MACD line equals signal liSignal Cross UpSignal Cross Down

Common misread: in MT5's built-in MACD, the bars are the MACD line itself. In this tool, the bars are MACD minus signal. When the histogram crosses zero, that is a signal-line cross, not MACD crossing its zero line. To see MACD's own zero crosses, read the panel's zero bias row (bars since the last zero cross) or turn on AlertOnZeroCross.

Reading divergence marks

A divergence mark always appears some bars after the swing it refers to. The swing has to be confirmed first. The figure shows how a bearish mark forms; the bullish case is the mirror image with swing lows.

How one MACD Divergence mark forms (bearish case)
  1. 1Price prints a swing highChecked against PivotLookback bars on each side
  2. 2Swing confirmedPivotLookback bars later, so the mark is that many bars behind the swing
  3. 3Compare with the previous swing highIt must be within MaxDivergenceLookback bars
  4. 4Price higher, MACD lowerHigher price high while MACD at this swing is lower
  5. 5Divergence mark and optional alertAlertOnDivergence fires once the mark is confirmed

This lag is part of the design. A late mark is a confirmed swing, not a repaint.

The regime panel

The panel sorts momentum into one of four regimes: Bull Strong, Bull Weak, Bear Strong or Bear Weak. The regime comes from MACD's sign and from where MACD sits relative to its signal line. The higher-timeframe row applies the same reading to the timeframe set in HTFTimeframe.

Inputs to change first

  • HTFTimeframe (default H4): set it above your chart's timeframe. On an H4 chart switch it to D1. On a D1 chart switch it to W1. It must always be above the chart's timeframe, or the row disappears.
  • PivotLookback (default 2, range 1-10): higher values mean fewer, cleaner swings, but marks arrive later. Lower values mean earlier marks and more noise. On M5 you could start at 3. The Lab has not tested this value, so compare it with the default.
  • MaxDivergenceLookback (default 100, range 20-300): how far apart the two compared swings can be. Lower it if you only care about recent swings.
  • FastEMA / SlowEMA / SignalPeriod (12 / 26 / 9): leave these at the defaults to start. A lower SignalPeriod gives earlier, more frequent crosses. A higher one gives fewer, later crosses.
  • AppliedPrice (Close): the price both EMAs use.
  • Display: ShowHistogram, ShowCrossArrows and ShowDashboard switch each part on or off. PanelScale resizes the panel. Theme (Dark) sets the chart colours, and RestoreTheme puts your original colours back when you remove the tool.

Alerts

All alerts are off until you set EnableAlerts to true. After that:

  • AlertOnCross (on): fires on a new closed-bar MACD/signal cross.
  • AlertOnDivergence (on): fires when a new divergence is confirmed.
  • AlertOnZeroCross (off): fires when MACD changes sign across zero on a closed bar.

Alerts can be delivered three ways:

  • AlertPopup (on): MT5 alert window.
  • AlertPush (off): MT5 mobile app linked to your terminal.
  • AlertSound (off): plays AlertSoundFile (alert.wav).

A decision rule to try

This rule is a suggestion to try. The Lab has not tested it.

  • Take a Signal Cross Up only when the higher-timeframe row reads Bull (Strong or Weak). Take a Signal Cross Down only when it reads Bear.
  • Skip a cross when the histogram bars on both sides of zero are barely visible: the lines are tangled, and the Lab has not measured how such crosses play out.
  • Treat a divergence mark as a warning to manage an open trade, not as an entry on its own.

Installation

  1. 1Download MACDIndicator.ex5 from the button above (Google Drive).
  2. 2In MetaTrader 5: File → Open Data Folder → MQL5 → Indicators. Copy MACDIndicator.ex5 there.
  3. 3Restart MT5 or right-click Indicators in Navigator → Refresh.
  4. 4Drag MACD onto a chart. For push alerts, enable "Allow push notifications" under Tools → Options → Notifications.
  5. Tested on MT5 build 6230.

Key terms and guides

MACD histogram
The MACD histogram is a bar chart under price that shows the gap between the MACD line and its signal line. Bars above zero mean MACD is above its signal. Growing bars mean momentum is building, and shrinking bars mean it is fading.
Higher high
A higher high is a swing high that peaks above the previous swing high. When higher highs and higher lows form in sequence, the market is in an uptrend.
Swing High/Low
A swing high is a candle whose high sits above the highs of the candles on both sides of it. A swing low is a candle whose low sits below the lows on both sides. Together they mark the turning points of price.
MACD
MACD (Moving Average Convergence Divergence) is a momentum indicator: the 12-period EMA minus the 26-period EMA, drawn with a 9-period signal line. It shows whether momentum is building, fading or turning, and whether the bias is bullish (above zero) or bearish (below zero).
Exponential moving average
The exponential moving average (EMA) is a moving average that gives the newest closes the most weight, so it turns sooner than a simple moving average. Traders use it to read trend direction and to time entries on pullbacks.
Signal line
A signal line is a moving average of an indicator's own line, such as the 9-period average of the MACD line. When the indicator crosses above or below it, traders read it as a change in momentum.

More on this subject: Oscillators & momentum guide, terms and tools

User reviews

No reviews yet. Members who download the tool can review it here.

Write a review

Sign in and download the tool to review it.

Build a checklist with it

MACD does one job on the chart: entry signal. Put it on the same chart as the tools below and the IndicatorFree panels merge into one checklist card, ordered trend, zone, signal, risk.

  • Trend / contextHull Moving AverageMACD tells you when; this tells you which way the market leans, so you can skip signals against it.
  • Zone / levelGolden Pocket ZonesShows the zones and levels, so you can see whether a signal from MACD fires at a level worth trading.

The Lab has not tested these combinations. Each tool is tested on its own; the card only lines up what each one says. Free members get 2 new tools a day. If one has to wait until tomorrow, install BlackBox to raise the limit to 5 a day (20 on a live account).

FAQ

Does MACD repaint?

No repaint detected. In a 9 Jul 2026 – 8 Oct 2026 test on EURUSD M15 (Raw Trading Ltd real ticks), 899 signals were logged at bar close and re-read at the end of the test: 0 changed. Arrows print on the bar that closes the signal, with no delay.

Can I use MACD in an EA?

Yes. Read buffer 4 (Signal Cross Up) with iCustom() on bar 1 — the last closed bar.

Why can’t my EA read the zones?

Zones and the panel are chart objects, not indicator buffers, so iCustom() does not return them.

How do I get alerts on my phone?

Enter your MetaQuotes ID under Tools → Options → Notifications, tick "Enable push notifications", and keep the push alert input on.

Why does it open in a separate window?

It plots values on their own scale, so MT5 draws it below the price chart.

Does it work on other pairs?

Tested on EURUSD only; other symbols not tested.

Why is the higher-timeframe row missing from the panel?

The row only appears when HTFTimeframe is above your chart's timeframe. The default is H4, so on an H4, D1 or higher chart, set it to a larger timeframe.

I switched on AlertOnCross but get no alerts. Why?

EnableAlerts is the master switch and is off by default, so turn it on first. Crosses are also only confirmed when a bar closes, so the alert comes at the close, not while the bar is still forming.

Can I turn off the divergence marks and keep only the crosses?

Yes. Set EnableDivergence to false. The cross arrows, lines, histogram and panel keep working as before.

Can I use it on gold, indices or other timeframes?

Yes. It calculates from the price of whatever chart it is on. The Lab's repaint test only covered EURUSD M15, so results on other markets and timeframes were not measured.

Changelog

  • 1.00Initial release: classic MACD (EMA 12/26 line, EMA 9 signal line, histogram) in a separate window, closed-bar signal-cross arrows, 4-corner regime classification (Bull Strong / Bull Weak / Bear Strong / Bear Weak),. · 2026-10-09

Final verdict

The Lab's view

Its signals are drawn on closed bars, and the repaint test found 0 of 899 changed. One window shows crosses, swing divergence and the higher-timeframe regime. That makes it a solid trigger: it times an entry once you already have a reason to trade.

What it cannot do

  • It has no outcome test. The Lab facts measure whether signals change, not how often a cross is followed by a move. Nothing on this page says the crosses make money.
  • It lags. Everything is built from EMAs, so crosses come after the turn. In sideways markets, crosses flip back and forth.
  • Its divergence check is basic. It compares two swings only, and every mark is PivotLookback bars late.
  • It was tested on one market. The repaint test covered EURUSD M15. Other symbols and timeframes were not measured.

Use it or skip it

MACD for MT5: use it when / skip it when
Use it when
  • –You want a closed-bar momentum trigger that won't redraw
  • –You trade with the higher-timeframe direction and want it shown in the panel
  • –You want alerts on crosses and divergence instead of watching the chart
Skip it when
  • –You need signals inside the current bar (it only signals on closed bars)
  • –You want a tested, stand-alone entry system
  • –You trade tight ranges where EMA crosses keep flipping

Settings to start with

Start with the defaults (12 / 26 / 9, Close, PivotLookback 2). Turn on EnableAlerts and keep AlertOnCross on. Keep HTFTimeframe one or two steps above your chart: the default H4 works on M15 and H1 charts, and D1 suits an H4 chart.

More oscillators & momentum tools