A crossover on its own fires far too often. The macd crossover strategy adds a rule that strips most of them out. A long counts only when the crossover happens below zero, and a short only above it. Arrows land on price, not in a pane.
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: BUY (MACD cross up below zero), SELL (MACD cross down above zero) |
| Alerts | popup, push notification, email, sound |
| Inputs | 21 |
On the chart: plots and colours
Two arrow plots, on price itself.
`BUY (MACD cross up below zero)` uses arrow 233 in aqua.
`SELL (MACD cross down above zero)` uses arrow 234 in orange red.
Marks sit `ArrowOffsetPts` `25` points clear.
A corner note lists the active filters.
No pane and no lines get drawn.
- BUY (MACD cross up below zero): arrow, width 2, arrow code 233
- SELL (MACD cross down above zero): arrow, width 2, arrow code 234
macd-crossover-strategy-buy-sell-signals.webp(will appear here after upload)
How each value gets built
The crossover
Two bars settle it. iMACD at `FastEma` `12`, `SlowEma` `26` and `SignalPeriod` `9` gives both lines. A change of side between bars is the crossover.
Which side of zero
`RequireZeroSide` is the point of the tool. A long needs its crossover under zero, where the move is still early. A short needs one above.
Optional trend gate
`UseTrendFilter` ships off. Switch it on and a `TrendEmaPeriod` `200` average has to agree. `MinBarsBetween` `3` then spaces out what survives.
Reading the output
Marks land on price, so no pane is needed.
The zero-side rule removes late crossovers.
A crossover above zero cannot print a buy.
The corner note tells you which filters are running.
`TargetTimeframe` is a label only and changes nothing.
Three bars of spacing keeps repeats down.
Alert channels in this build: popup, push notification, email and sound, one message per closed bar.
Five switches govern the messages here. `EnableAlerts` opens the set and arrives on beside `EnablePopup`. The other three wait: `EnablePushNotify` for the mobile terminal, `EnableEmail` for outgoing mail, and `EnableSound` with `SoundFile` behind it.
Every MACD Crossover Strategy input
Core settings
| Setting | What it does | Default |
|---|---|---|
FastEma |
MACD fast EMA period. Quicker leg of the calculation, `12`. | 12 |
SlowEma |
MACD slow EMA period. Slower leg, `26`. | 26 |
SignalPeriod |
MACD signal SMA period. Length of the line the main one is measured against, `9`. | 9 |
RequireZeroSide |
Longs only below zero, shorts only above. Longs below zero only, `true`. | on |
UseTrendFilter |
Require price on the right side of the EMA. Ask a long average to agree first, `false`. | off |
TrendEmaPeriod |
Trend EMA period (trading timeframe). How long that average runs, `200`. | 200 |
TargetTimeframe |
Intended timeframe (note only). | PERIOD_H1 |
MinBarsBetween |
Minimum closed bars between same-side signals. Enforced gap between same-side marks, `3`. | 3 |
Display settings
| Setting | What it does | Default |
|---|---|---|
ArrowOffsetPts |
Arrow offset from the bar (points). Distance from mark to candle, `25`. | 25 |
BuyColor |
BUY arrow color. | aqua |
SellColor |
SELL arrow color. | orange red |
Alert settings
| Setting | What it does | Default |
|---|---|---|
MaxBars |
History bars to scan (0 = all). Depth of the scan, `1500`. | 1500 |
ShowNote |
Show the filter-state note. Print the filter state in the corner, `true`. | on |
NoteX |
Note X (px). | 12 |
NoteY |
Note Y (px). | 22 |
EnableAlerts |
Master alert switch. | on |
EnablePopup |
Popup alert. | on |
EnablePushNotify |
Push notification to phone. | off |
EnableEmail |
Email alert. | off |
EnableSound |
Sound alert. | off |
SoundFile |
Sound file. | alert.wav |

Where this one belongs
`TargetTimeframe` `PERIOD_H1` records the intended chart without enforcing it. EURUSD H1 is the reference chart. Marks come a few times a week there. On M5 the zero-side rule still leaves too many. On H4 they are rare.
What this one cannot tell you
The zero-side rule also removes good late entries.
A 200 average on H1 is over a week of history.
Three lagging averages sit behind every mark.
The timeframe input is a note and enforces nothing.
Copy the compiled MACD Crossover Strategy 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 MACD Crossover Strategy for MT4 and MT5
The zip holds the compiled MACD Crossover Strategy 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 strategy free
Enter your email and the file is yours. You also get the full MT4 and MT5 library.
FAQ
What does RequireZeroSide actually remove?
Crossovers that happen late in a move. A cross up while the main line already sits above zero usually comes after a rally is underway, and requiring it below zero keeps only the earlier ones.
Does TargetTimeframe PERIOD_H1 enforce anything?
No, and this is worth knowing. It records the timeframe the tool was designed for and prints it in the note, but the calculation runs on whatever chart you load it onto regardless.
When is UseTrendFilter worth switching on?
On a chart that ranges. The two hundred bar average then blocks marks pointing against the wider move, which cuts the count hard and leaves the ones that agree with the bigger picture.
Why does MinBarsBetween 3 exist?
Because the two MACD lines can cross back and forth within a few bars when they run close together. Three bars of spacing turns that flurry into a single mark rather than four.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the MACD Crossover Strategy as one input. Always backtest before trading live.
Related on forexmt4systems.com: MTF MACD Indicator MT4 + MT5.
FAQ
Is this MACD Crossover Strategy suitable for beginners?
It is approachable for traders who already know the basics of order types and risk per trade. If you are completely new to MT4 or MT5, work through a few weeks of demo before live capital.
What account size do I need?
Account size depends on your risk per trade and your stop distance. Most traders running this style risk between 0.5% and 1% per trade while validating the rules.
Can I use this strategy on other pairs?
Yes. The rule set is generic. Major pairs and gold (XAUUSD) tend to behave most consistently. Backtest before applying it to exotic crosses.
How many trades does it produce?
On the H1 chart of EURUSD, expect a handful of valid setups per week during active sessions. Quiet weeks happen — the rules aim to keep you out of those.
Reading the signals
Do I need a paid platform or feed?
No paid feed is required. Your standard MT4 or MT5 broker feed is enough. If your broker has unusual session hours, adjust the session filter accordingly.
For external background reading, see the Babypips forex school.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed. Past performance is not indicative of future results. The MACD Crossover Strategy is a framework. Test it and adapt it to your risk tolerance before live capital.
Authoritative references
- Learn more about the MACD.
- General background on technical indicators.
