Dual Time Frame MACD Indicator: Two Charts Agreeing

Written by Dominic Walsh · Published · Last updated

The dual time frame macd indicator runs the same MACD twice. Once on the chart in front of you, once on the timeframe named in `InpUpperTF`. An arrow needs both readings above zero. Both main lines must also lead their signals. On top of that, one of the two has to have crossed just now.

This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.

Platforms MT4 (.ex4) + MT5 (.ex5)
Chart window Main price chart
Plots 2: DualMACD Buy, DualMACD Sell
Alerts popup
Inputs 7

What the Dual Time Frame Macd Indicator draws on the chart

DualMACD Buy places a lime arrow when both timeframes turn positive together.

DualMACD Sell places a red arrow for the mirror case below zero.

An OBJ_LABEL reports the current reading on both timeframes in the chart corner.

`InpArrowOffset` at `12` sets the clearance between arrow and candle in points.

  • DualMACD Buy: arrow, lime, width 2, arrow code 233
  • DualMACD Sell: arrow, red, width 2, arrow code 234
Dual time frame MACD indicator on EURUSD H1 with H4 agreement arrows
Dual time frame MACD indicator on EURUSD H1 with H4 agreement arrows

How the Dual Time Frame Macd Indicator calculates its values

Reading the chart timeframe

iMACD supplies the main and signal lines at `InpFastEMA` `12`, `InpSlowEMA` `26` and `InpSignalSMA` `9`. `InpPrice` sets the source. The code reads the current bar and the one before it. That pair is what lets it spot a crossing rather than a state.

Mapping onto the higher timeframe

iBarShift converts the bar time into an index on `InpUpperTF`. The default there is PERIOD_H4. iMACD then runs again with the same three periods. One set of periods across both keeps the comparison fair.

Demanding agreement

buyTrigger needs four things at once. Both main lines above zero. Both above their signals. And a fresh upward crossing on either timeframe. The sell case inverts all four, which is why these arrows are much rarer than a plain MACD crossing.

How to read the signals

An arrow means the two timeframes agree, not that the move is about to start.

The label in the corner tells you the state even when no arrow has fired.

Both readings above zero is a slower condition than a simple crossing.

Widen the gap between chart and `InpUpperTF` for stronger filtering.

Alert channels in this build: popup, one message per closed bar.

`InpAlertsOn` ships on and drives a terminal popup. This build carries no push, email or sound channel. The guard allows one message per closed bar, so a condition that stays true will not repeat itself.

Every Dual Time Frame Macd Indicator input

Core settings

Setting What it does Default
InpUpperTF Higher timeframe. Higher timeframe for the second reading, default PERIOD_H4. PERIOD_H4
InpFastEMA MACD fast EMA period. Fast EMA in both MACD calculations, default `12`. 12
InpSlowEMA MACD slow EMA period. Slow EMA in both, default `26`. 26
InpSignalSMA MACD signal period. Signal average in both, default `9`. 9
InpPrice Applied price. Applied price for both readings, default PRICE_CLOSE. PRICE_CLOSE

Display settings

Setting What it does Default
InpArrowOffset Arrow offset in points. Arrow clearance from the bar in points, default `12`. 12

Alert settings

Setting What it does Default
InpAlertsOn Enable alerts. Popup on a fresh trigger, default `true`. on
Dual time frame MACD indicator inputs: InpUpperTF, InpFastEMA, InpSlowEMA, InpSignalSMA
Dual time frame MACD indicator inputs: InpUpperTF, InpFastEMA, InpSlowEMA, InpSignalSMA

Settings that fit your chart

Two-timeframe agreement suits instruments that trend for hours rather than minutes. EURUSD H1 with `InpUpperTF` at PERIOD_H4 is the reference pairing. A four-to-one ratio is about right. M15 against H1 also works. Two adjacent timeframes give you almost no filtering.

When the Dual Time Frame Macd Indicator fails

Demanding four conditions at once means the arrow lands well into a move.

The higher-timeframe reading holds one value across several chart bars. Agreement can look more settled than it is.

Both readings above zero may never appear during a long sideways stretch.

Copy the compiled Dual Time Frame Macd Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.

Download the Dual Time Frame Macd Indicator for MT4 and MT5

The zip holds the compiled Dual Time Frame Macd Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. Enter your email below and the download link arrives in your inbox.

Download this indicator free

Enter your email and the file is yours. You also get the full MT4 and MT5 library.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

What does InpUpperTF at PERIOD_H4 filter out?

Every chart crossing the higher timeframe disagrees with. iBarShift maps each bar onto its H4 parent. The same MACD runs there. A buy needs both main lines above zero and above their signals, so a local crossing against the H4 reading produces nothing.

Why must both MACD lines sit above zero?

Because zero separates the two averages behind MACD. Above it the fast average leads the slow one. That is an upward bias for these settings. Requiring it on both timeframes strips out crossings that happen inside a larger decline.

Does InpFastEMA apply to both timeframes?

Yes. `InpFastEMA` `12`, `InpSlowEMA` `26` and `InpSignalSMA` `9` feed both calls to iMACD. Different periods per timeframe would make the two readings measure different things. The agreement test would then mean nothing at all.

What does the OBJ_LABEL show for InpUpperTF?

The current main line reading for the chart period and for `InpUpperTF`, refreshed as bars close. It lets you see the state between arrows. That matters here, because the arrow conditions are strict and can go a long time without firing.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Dual Time Frame Macd Indicator as one input. Always backtest before trading live.

Category: this is part of our Oscillators collection. Also, truly, browse more Oscillators for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.

External references

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment