On this page
What this MACD indicator adds
MACD compares a fast and slow exponential moving average. This program displays the main output and a red signal line in a separate window, with optional arrows on price and alerts for selected events. It helps distinguish a change in relative momentum from a crossing of the zero line.
The download is MACD with Alert FBR edition 1.03, a marked Apache-licensed derivative of EarnForex 1.02. FBR documents buffer alignment, history checks, arrow placement and instance-only cleanup. Source is supplied for compilation; the indicator does not place trades or manage stops.
12/26/9, SMA signal and two crossing families
At the defaults, Main=EMA(Close,12)−EMA(Close,26), and Signal=SMA(Main,9). The signal average is simple, unlike EMA-based signal versions elsewhere. MACDType changes Main between bars and a line; its histogram shows Main, not Main−Signal. The latter difference is often called OsMA.
MACD_MAIN_SIGNAL_CROSS, the default, labels a strict change from Main below Signal to Main above Signal BUY(CROSS); the reverse is SELL(CROSS). MACD_MAIN_SWITCH_SIDE labels Main below zero then above zero BUY(SWITCH), and above then below SELL(SWITCH). Both compared readings must lie strictly on opposite sides; equality does not qualify.
MACD_MAIN_ALL checks both families, but returns the zero-cross event first if both qualify on the same evaluated candle. One event and arrow are selected there. Crosses can occur below or above zero; BUY/SELL are event names, not executed trades or guaranteed reversal instructions.
24 functional inputs and FBR defaults
Both platform sources have these 24 controls and four decorative Comment headings. Use positive periods with fast no greater than slow, a nonnegative scan and arrow sizes 1–5. Each instance on the same chart needs a different nonempty IndicatorName.
| Input | Default | Practical meaning |
|---|---|---|
IndicatorName | FBR-MACDWA | Instance name and arrow prefix; choose a unique name per chart instance. |
MACDFastEMA | 12 | Fast EMA period, default 12. |
MACDSlowEMA | 26 | Slow EMA period, default 26; at least the fast period. |
MACDSMA | 9 | Simple average period for Signal, default 9; not an EMA selector. |
MACDAppliedPrice | PRICE_CLOSE | Applied price; Close by default, with other native price types available. |
AlertSignal | MACD_MAIN_SIGNAL_CROSS | Selects main/signal crossings, zero crossings, or both with zero-event priority. |
CandleToCheck | CURRENT_CANDLE | Current evaluates the forming candle; Previous evaluates a completed candle. FBR marks that evaluated candle. |
MACDType | MACD_TYPE_HISTOGRAM | Draws Main as a histogram or a line; calculations and comparisons remain the same. |
BarsToScan | 500 | History scan, default 500. In FBR, 0 uses available history and increases work. |
EnableNotify | false | Master notification switch. False disables all delivery channels. |
SendAlert | true | Popup is true, but inactive while EnableNotify=false. |
SendApp | false | Mobile push, initially false; terminal configuration required. |
SendEmail | false | Email, initially false; terminal configuration required. |
EnableDrawArrows | true | Threshold-event arrows, enabled by default. |
ArrowBuySwitch | 241 | Wingdings code for upward zero-cross arrows. |
ArrowSellSwitch | 242 | Wingdings code for downward zero-cross arrows. |
ArrowSizeSwitch | 3 | Zero-cross arrow size, 1–5. |
ArrowColorBuySwitch | clrGreen | Colour of BUY(SWITCH) arrows. |
ArrowColorSellSwitch | clrRed | Colour of SELL(SWITCH) arrows. |
ArrowBuyCross | 233 | Wingdings code for upward main/signal arrows. |
ArrowSellCross | 234 | Wingdings code for downward main/signal arrows. |
ArrowSizeCross | 3 | Main/signal arrow size, 1–5. |
ArrowColorBuyCross | clrGreen | Colour of BUY(CROSS) arrows. |
ArrowColorSellCross | clrRed | Colour of SELL(CROSS) arrows. |
Real EUR/USD: signal crosses, zero crosses and faster settings
These original charts use archived Yahoo Finance EURUSD=X H1 OHLC in UTC. FBR reconstructed first-price-seeded EMAs and an SMA signal using the full available archive. The displayed windows follow a long warm-up; they are calculated illustrations, not native MetaTrader screenshots or a tick replay.



The provider does not identify these as broker-specific Bid/Ask execution prices. Native history and initialization can differ. Spreads, fills and returns were not measured. Scroll charts horizontally on narrow screens.
Download the illustrated readings (CSV) · 1Download the illustrated readings (CSV) · 2
Alerts, candle choice and repeat suppression
EnableNotify=false is the master default even though SendAlert=true. Enable both for popups; push and email also need their terminal settings. Current is the default and can generate a temporary event or an arrow that disappears before close. Previous uses the completed candle; FBR attaches the arrow to that evaluated candle.
The retained direction state suppresses a repeated identical event until the state changes or becomes neutral. Previous notifications are also gated by new chart-bar time. There is no separate sound-file setting or seconds-based cooldown input in this program, and it does not promise one message for every historical arrow.
The retained email and push format includes broker company, account name and account number. These channels start disabled; downloading activates none. Native notification delivery and chart-object behaviour have not been tested by FBR.
Compile and install the FBR source edition
Choose MQ4 for desktop MT4 or MQ5 for MT5. These derivative ZIPs contain no ready EX4/EX5; compile the correct source in the matching MetaEditor.
- Download and extract the ZIP for your platform.
- In MetaTrader choose File → Open Data Folder, then MQL4 or MQL5.
- Copy Indicators and Files there; MT5 also needs Include. The separate upstream copy is reference material.
- Open MACD_Alert_FBR.mq4 or MACD_Alert_FBR.mq5 in matching MetaEditor, choose Compile (F7), and inspect compiler errors.
- Refresh Navigator → Indicators, attach MACD_Alert_FBR to a demo chart, choose a unique IndicatorName and check inputs, history and Experts/Journal.
FBR has not compiled or run these files in MetaTrader. Formula, event and index-model checks do not replace native runtime testing. Verify the compiled indicator on a demo chart first.
Download MACD with Alert FBR free
Each ZIP includes modified platform source, untouched original reference source, required author icon and MT5 includes, full Apache 2.0 license, change log, patch, instructions and SHA-256 checksums. No registration or broker account is needed to download.
FBR 1.03 identifies this derivative of EarnForex 1.02. Original attribution is retained and changes are marked. The modified program is supplied as source for platform-specific compilation.
Free source ZIP · FBR 1.03 · Compile in MetaEditor
Forming values, initialization and review limits
Current-candle Main, Signal and arrows can change before close. History corrections, feed differences and the starting point can alter past values too. The numerical reconstruction does not certify native iMACD initialization, all terminal builds or notification delivery.
FBR sets series order after binding, bounds both buffers and neighbouring comparisons, checks MT5 copies and releases its handle. Arrows use the evaluated candle and cleanup uses only the instance arrow prefix. BarsToScan=0 can increase workload. Different same-chart instances require distinct names.
MACD is unbounded and measured in price units: its amplitude is not directly comparable across different symbols. Crossings can repeat in ranges and arrive after a substantial move. Our checks do not execute MQL, test intrabar paths or establish entry, exit, position size or profitability.
Frequently asked questions
Is the histogram Main minus Signal?
No. In this program the bars display Main=fast EMA−slow EMA. Signal is a separate SMA line; Main−Signal is a different derived quantity.
Does the signal line use EMA9?
No. Default MACDSMA=9 refers to a simple moving average of Main. Other MACD implementations can differ.
Can ALL produce two arrows on one candle?
The code gives a qualifying zero cross priority over a simultaneous main/signal cross, selecting one event and arrow for that evaluation.
Why can an arrow disappear or no popup appear?
Current can change before close, and EnableNotify=false globally disables delivery. State and candle rules also affect repeats.
Are compiled platform files included?
No. Compile MQ4/MQ5 in matching MetaEditor. This is a marked FBR 1.03 derivative; native compilation/runtime has not been performed by FBR.
Sources and verification scope
Original source and license were matched to a pinned EarnForex revision. FBR modifications are marked. Independent EMA/SMA and event-model checks support the illustrations, without replacing a native terminal or strategy test.