MACD Multi Timeframe Signal Alerts MT4
- Indicatori
-
Allan Aparece Ninal
Sviluppo indicatori ed Expert Advisor per MetaTrader 5.
Come lavoro:
- Ogni indicatore viene controllato contro il repainting: i segnali vengono decisi solo su barre chiuse, e un test su ogni tick conferma che non cambiano in seguito. - Versione: 1.0
MACD Multi Timeframe Signal Alerts MT4 is a free MetaTrader 4 indicator that draws MACD from the chart's timeframe or any higher one, with a four-colour histogram. It marks a BUY or SELL when MACD crosses its signal line, marks zero-line crosses, and sends alerts.
It places no trades.
It follows the public MACD method by Gerald Appel, written in MQL4 from the formula. It runs in its own window below the chart.
MetaTrader 4 edition: the same calculation, inputs, signals and alerts as the MetaTrader 5 version. MetaTrader 4 has no colour buffers, so the histogram is four buffers, one per colour.
Standalone: everything is built in. You do not need to install any other product named on this page.
What you see on the chart
- MACD as a soft blue line and its signal line as a thin grey line.
- The histogram (MACD minus the signal line) in four colours. Above zero: strong green while it rises, pale green while it falls. Below zero: pale red while it rises, strong red while it falls.
- A green dot on the MACD line for a BUY: MACD crosses above its signal line.
- A red dot for a SELL: MACD crosses below its signal line.
- A small mark on the zero line when MACD crosses zero, green upward and red downward.
- A matching arrow on the price chart for each BUY and SELL.
- A small label in the window: the timeframe used, the histogram's state, and the latest signal with its age.
The colours are soft mid-tones that read on dark and light charts.
Higher timeframe without repainting
Set Timeframe to H4 on an H1 chart and the window shows the H4 MACD. A chart bar shows the newest H4 bar that has closed when the chart bar closes. The line steps once per H4 bar, on the H1 bar that completes it, and stays there.
Many multi-timeframe indicators show the forming higher-timeframe bar on older chart bars, so their history looks better than it was live. This one never does: what you see on a past bar is what it showed at that bar's close.
How the signal is built
MACD is the 12-bar EMA of the close minus the 26-bar EMA. The signal line is the 9-bar EMA of MACD (or an SMA, as in MetaTrader's own MACD). The histogram is the gap between them.
Everything is decided at the close of a bar. A dot, arrow or alert appears on the bar that closed with the cross. It never moves afterwards.
Who it is for
For traders who read MACD on a higher timeframe while they trade a lower one, and for those who know the four-colour MACD from TradingView.
Not for you if you want a ready-made trading system. MACD crosses often, and you decide which crosses matter.
Inputs
| Input | Default | Description |
|---|---|---|
| Timeframe | current | the chart's own, or a higher one up to W1. A lower one falls back to the chart's. |
| Fast EMA / slow EMA / signal line length | 12 / 26 / 9 | - |
| Signal line average | EMA | EMA (TradingView) or SMA (MetaTrader's MACD). |
| BUY only below zero, SELL only above zero | off | when on, a cross on the other side gets only a small grey dot. |
| Mark crosses the zero filter skipped | on | - |
| Mark zero-line crosses | on | - |
| Alert on zero-line crosses too | on | - |
| Arrows on the price chart | on | for BUY and SELL, on the last 2000 bars. |
| Arrow colours | blue / red | - |
| State label in the window | on | - |
| Pop-up | on | - |
| Sound | off (file alert.wav) | - |
| Push | on | - |
| off | - | |
| Debug log for bug reports | off | see Found a problem? |
How often
Per month per symbol with the defaults (EURUSD, GBPUSD, USDJPY, XAUUSD, BTCUSD, closed bars, 2024 to 2026; a code count, not a trading result). BUY and SELL together: M15 about 152 to 234, H1 about 37 to 55, H4 about 9 to 14, D1 about 1 to 2. Zero-line crosses: M15 about 67 to 106, H1 about 16 to 25, H4 about 4 to 7, D1 about 1. With a higher timeframe set, the counts are those of that timeframe.
Alerts and Expert Advisor use
One alert per closed bar, never while the history loads. The message says BUY or SELL (and the zero cross, if any), the timeframe used and the close. For push alerts, set your MetaQuotes ID under Tools, Options, Notifications.
Buffers for Expert Advisors (iCustom): 4 is MACD and 5 is the signal line. Buffers 0 to 3 hold the histogram, one buffer per colour (rising above zero, falling above zero, rising below zero, falling below zero). Buffer 7 holds MACD on a BUY bar and buffer 8 on a SELL bar. Buffers 9 and 10 hold 0 on a zero cross up and down. They are empty otherwise.
How it was checked
Code check: an independent Python version was compared bar by bar with MACD, the signal line, the four histogram colours and every signal and zero cross. It ran in the MetaTrader 4 Strategy Tester on EURUSD, GBPJPY, XAUUSD and BTCUSD at M15, H1 and H4 with three input sets, one of them with the H4 MACD. All 36 files matched (66,512 signals and zero crosses).
Code check: an every-tick run on EURUSD H1 with the H4 MACD (8.4 million ticks, 4,812 closed bars, 132 signals and zero crosses). 0 changed after their bar closed and 0 showed on the live bar.
Works well with
These are workflow suggestions. I have not found that any pair gives better trading results. You do not need any of them.
| Product | How to use them together | Why |
|---|---|---|
| Risk Position Tool MT4 | Pick the trade from the chart, then drag the entry and stop lines. The tool gives the lot for your risk. | It separates where you enter from how much you risk. The tool places no orders. |
| Session Levels MT4 | Add it to the same chart. | It draws session boxes, killzones and previous day and week levels as context. It is not a signal. |
| Divergence Signal Alerts MT4 | Add it to the same chart. | It marks RSI and MACD divergences against price, a second view of the same momentum. |
| WaveTrend Signals MT4 | Add it to the same chart. | It marks WT1 and WT2 crosses in the overbought and oversold zones, another view of momentum. |
| Indicator Arrow Trader MT4 | Name this indicator and the buffers that hold its signals in the EA. | The EA trades the signals of an indicator you choose, on the closed bar, with a stop loss and a fixed 0.01 lot. Test it on a demo account first. |
| Repaint and Signal Scorecard MT4 | Name this indicator and the buffers that hold its signals in the scorecard. | It checks whether those signals repaint and how they did on the chart's history. It places no trades. |
Questions
Does it repaint? The lines of the forming bar move with price. Once a bar has closed, its values, dots, arrows and alerts do not change. With a higher timeframe, a chart bar shows only higher-timeframe bars that had closed by then.
Why does the line look like steps with a higher timeframe? Each step is one closed higher-timeframe bar. A smooth line would need the forming bar, which changes until it closes.
Is there a MetaTrader 5 version? Yes, MACD Multi Timeframe Signal Alerts, with the same inputs and signals.
Why does it differ a little from another MACD? Versions differ in how the averages start and in the signal line (EMA or SMA). Here the EMAs start from the average of their first bars, as on TradingView.
Does it work in the Strategy Tester? Yes, in visual mode, on any symbol.
Does it work on gold and crypto? Yes, on any symbol and timeframe.
Will I get alerts on my phone? Yes, push is on by default. Set your MetaQuotes ID.
Custom work
Want an EA that trades this indicator, a custom version of it, or a new indicator or EA of your own? Order it through MQL5 Freelance and choose me as the developer: order through Freelance. Send your requirements, rules and the flow or algorithm you want. The whole order, payment and delivery stay inside MQL5 Freelance.
Found a problem?
- In the inputs, set "Debug log for bug reports" to true.
- Repeat what went wrong.
- Open the Experts tab in the Toolbox. Copy the lines that start with "DBG" and paste them in a comment on this page, with the symbol and timeframe.
- Set the debug log back to false.
The debug lines never contain your account number, name, server, balance or equity.
If it helps your trading, a short review on this page helps other traders find it.
Questions: use the comments on this page or send me a message on MQL5.
The defaults are a starting point. An indicator does not predict price, and trading carries a risk of loss.
