المذبذبات MomentumTrend FollowingCrossover متاح في المنشئ

Moving Average Convergence Divergence (MACD)

MACD

MACD is an unbounded momentum oscillator built from two moving averages. It tracks the gap between a fast and a slow EMA to show when momentum is accelerating, stalling, or turning — and its signal-line and zero-line crossovers make it one of the most direct indicators to turn into a no-code EA.

Default settings
12 / 26 / 9
Signal period
9
Centre
Zero line
Zero lineMAIN_LINE (histogram)SIGNAL_LINE

توضيحي — بيانات اصطناعية، ليست تسعيرة مباشرة.

What MACD tells you

MACD turns two moving averages into a single momentum reading. It subtracts a slow EMA from a fast one, so the result grows when a move is accelerating and shrinks as it fades — and a second, smoothed line marks the moment that momentum changes hands.

  • Above zero: the fast EMA leads — bullish momentum bias
  • Below zero: the slow EMA leads — bearish momentum bias
  • MT5 draws MAIN_LINE as the histogram — the bars are the MACD line, not MACD minus signal
  1. 1 Fast EMA minus slow EMA → MAIN_LINE
  2. 2 MAIN_LINE smoothed → SIGNAL_LINE
  3. 3 MT5 draws MAIN as bars, SIGNAL as a line
عرض الصيغة وتفاصيل الحساب

MACD is derived from moving averages of price — the 12, 26, and 9 period settings by default. In MetaTrader 5 the indicator publishes two buffers:

  1. Compute the fast EMA (12 periods) and the slow EMA (26 periods) of the applied price.
  2. Subtract the slow EMA from the fast EMA. This difference is MAIN_LINE (buffer 0): MAIN = EMA(12) − EMA(26). The MT5 terminal draws this buffer as the histogram.
  3. Average MAIN_LINE over the signal period to get SIGNAL_LINE (buffer 1): SIGNAL = MA(MAIN, 9). MT5’s standard MACD uses a simple moving average here; the classic construction uses a 9-period EMA. The terminal draws this buffer as the line over the histogram.

There is no third buffer. MAIN − SIGNAL — the quantity most other charting packages draw as the MACD histogram — is a separate MetaTrader indicator, the Moving Average of Oscillator (OsMA), called with iOsMA. Keeping the two names apart matters in practice: “the histogram flipped sign” means something different on an MT5 chart (MAIN crossed zero) than it does elsewhere (MAIN crossed SIGNAL).

Because it is built from moving averages rather than a bounded ratio, MACD is unbounded. Its values scale with the instrument’s price and volatility, so a reading of 0.0020 on EUR/USD is not comparable to 0.20 on an index. What carries meaning is MAIN_LINE’s position relative to zero and to SIGNAL_LINE, not the absolute number.

In MQL5 the call is iMACD(symbol, period, fast_ema_period, slow_ema_period, signal_period, applied_price). applied_price is a full ENUM_APPLIED_PRICE argument, so the EMAs can be built from Open, High, Low, Median, Typical or Weighted price as well as Close. Gerald Appel developed the original MACD in the late 1970s.

الإشارات

الإشارات المتميزة والقابلة للاختبار التي يوفرها MACD — والنظام الملائم لكل منها.

Signal-Line Crossover

جاهز في المنشئ
الشرط
The MAIN_LINE histogram crosses its SIGNAL_LINE
أفضل نظام
Trending or turning markets
الاستخدام النموذجي
Time entries as momentum changes hands

Zero-Line Crossover

جاهز في المنشئ
الشرط
MAIN_LINE crosses above or below zero
أفضل نظام
Established trends
الاستخدام النموذجي
Confirm the momentum bias has actually flipped

Divergence

منطق متقدم
الشرط
Price makes a new extreme, MAIN_LINE does not
أفضل نظام
Trend exhaustion
الاستخدام النموذجي
Anticipate a stall before price confirms

OsMA Momentum

جاهز في المنشئ
الشرط
MAIN_LINE minus SIGNAL_LINE — the OsMA indicator — grows or shrinks
أفضل نظام
Either regime
الاستخدام النموذجي
Read acceleration before the crossover completes

تنفيذ MT5

ما يحسبه ويرسمه ميتاتريدر 5 فعليًا — وهو المرجع الذي كُتبت وفقه كل قاعدة في هذه الصفحة.

المخازن

الفهرس المخزن طريقة الرسم في MT5 ما يحتويه
0 MAIN_LINE Histogram Fast EMA minus slow EMA. This is the buffer the MT5 terminal draws as the histogram — it is the MACD line itself, not a difference from the signal.
1 SIGNAL_LINE Line MAIN_LINE smoothed over the signal period, drawn as the line over the histogram. MT5's standard MACD smooths it with a simple moving average.

ملاحظات المنصة

يعمل بشكل أفضل / استخدم بحذر

لا يوجد مؤشر ذو ميزة شاملة. إليك أين يساعد MACD — وأين يضلل.

يعمل بشكل أفضل

  • Trending markets
  • Clear momentum shifts
  • With a trend or volatility filter
  • On higher timeframes

استخدم بحذر

  • Tight, directionless ranges
  • MACD alone as an entry
  • Fast settings on low timeframes
  • Optimised settings without validation

بناء استراتيجية MACD

اربط الإشارة بقواعد الدخول والخروج، ثم صدّر EA MT5 قابلاً للترجمة — بدون كود.

  1. MACD MAIN (12/26/9)
  2. MACD SIGNAL (12/26/9)
  3. MAIN crosses above SIGNAL → Open Buy · SL 40 / TP 80
  4. MAIN crosses below SIGNAL → Open Sell

دمج MACD مع مؤشرات أخرى

نادراً ما يقف مؤشر واحد وحده. هذه التوليفات تغطي النقاط العمياء لـ MACD.

MACD + OsMA

  1. OsMA above zero
  2. OsMA rising against its own value 3 bars back
  3. Buy
السبب
OsMA is MAIN minus SIGNAL, so it crosses zero at the same bar the two lines cross — but it also states how far apart they are, which lets a rule ask whether the gap is still widening instead of only whether it has closed
أفضل نظام
Trending

There is no template that places MACD and OsMA in one flow, and there should not be: OsMA is MAIN − SIGNAL, so both together would state the same crossover twice. The OsMA Re-acceleration + Zero Line template shows the OsMA form on its own.

افتح المنشئ →

MACD + RSI

  1. MAIN crosses above SIGNAL
  2. RSI > 50
  3. Buy
السبب
Confirm a MACD crossover only when a bounded momentum gauge agrees, filtering the flat-market whipsaws MACD is prone to
أفضل نظام
Trending

No template pairs MACD with RSI. Start from MACD Signal and add an RSI node, a Compare at 50 and an And gate ahead of the Buy action.

افتح المنشئ →

MACD + ADX

  1. ADX > 25
  2. MAIN crosses above SIGNAL
  3. Buy
السبب
Take MACD crossovers only when ADX confirms a real trend, since MACD signals inside a dead range are mostly noise
أفضل نظام
Trending

No template pairs MACD with ADX. Start from MACD Signal and add an ADX node with a Compare at 25 — the ADX Trend template shows that filter wired up.

افتح المنشئ →

MACD + Moving Average

  1. Price > 200 MA
  2. MAIN crosses above SIGNAL
  3. Buy
السبب
Trade MACD crossovers only in the direction of a higher-timeframe moving average, so you are never fighting the dominant trend
أفضل نظام
Trend continuation

No template pairs MACD with a moving average. Start from MACD Signal and add an MA node plus a Price node into a Compare, gated with And.

افتح المنشئ →

المعاملات

قيم أولية للتحقق على زوجك الخاص وإطارك الزمني — ليست إعدادات مضمونة.

المعامل الافتراضي نطاق الاختبار المقترح ما يفعله
Fast EMA 12 5–20 The faster moving average. Shorter reacts sooner and fires more crossovers; longer is calmer and slower to turn.
Slow EMA 26 20–40 The slower moving average. The gap between fast and slow is MAIN_LINE itself — widen it for fewer, larger swings.
Signal period 9 5–15 Averaging period applied to MAIN_LINE to produce SIGNAL_LINE. Lower is twitchier; higher lags more but whipsaws less. MT5's standard MACD smooths with a simple moving average, so this is a period, not an EMA length.
Applied price Close Close / Open / High / Low / Median / Typical / Weighted Price series the two EMAs are built from. Close is the MT5 default and the standard choice; iMACD accepts any ENUM_APPLIED_PRICE value, so this is selectable, not fixed.

الإعدادات المسبقة الأولية

Standard 12 / 26 / 9 Appel's default baseline
Faster 8 / 17 / 9 Reacts sooner, more whipsaw
Slower 19 / 39 / 9 Fewer, higher-conviction signals

أمثلة السوق

أين يعمل MACD، وأين يفشل، وكيف يغير الفلتر النتيجة.

يعمل

Crossover that caught the trend

As a market began to trend, MAIN_LINE crossed up through SIGNAL_LINE near the zero line and the move followed through — the textbook momentum-entry case.

يفشل

Whipsaw in a flat market

In a tight range MAIN_LINE hugs SIGNAL_LINE and crosses back and forth. Trading every cross here churns costs with no move to ride.

مُصفّى

Filtered by trend strength

Add an ADX or moving-average filter and the same cluster of crossovers is ignored while the market goes nowhere — the filter is what separates a real signal from range noise.

FAQ

What are the best MACD settings for an EA?
12 / 26 / 9 is Gerald Appel's default and the right starting point. Faster settings (for example 8 / 17 / 9) react sooner but whipsaw more; slower ones give fewer, higher-conviction signals. Treat any setting as a baseline to re-validate on your own pair and timeframe in a backtest, not as portable truth.
Is the signal-line cross or the zero-line cross better?
They answer different questions. The signal-line cross times momentum changing hands and fires earlier; the zero-line cross confirms the momentum bias has actually flipped and fires later with fewer false starts. A common EA design uses the zero line as a filter and the signal cross as the trigger.
Why does MACD whipsaw so much in ranges?
Because it is built from moving averages. In a flat market the fast and slow EMAs sit almost on top of each other, so MAIN_LINE crosses SIGNAL_LINE repeatedly with no trend to profit from. Pair it with a trend-strength filter such as ADX, or a higher-timeframe moving average, before trading the crosses.
Where is the MACD histogram in MT5?
The histogram you see on an MT5 chart is MAIN_LINE — the fast EMA minus the slow EMA — drawn as bars, with SIGNAL_LINE as the line over it. iMACD has no third buffer. The MACD-minus-signal histogram used by most other charting packages exists in MT5 as a separate indicator, OsMA (Moving Average of Oscillator), reached with iOsMA. So bars shrinking toward zero on an MT5 MACD means momentum itself is fading, not that the two lines are converging.
Is the MT5 signal line a 9-period EMA?
No. MT5's standard MACD averages MAIN_LINE with a simple moving average over the signal period, while the classic construction uses a 9-period EMA. That is why this page says signal period rather than signal EMA. The two shapes are similar, but crossovers can land a bar apart — enough to matter when comparing an MT5 backtest with a chart drawn in another package.
How should I validate MACD settings before going live?
Backtest on quality tick data first, then run the EA on a demo account before risking money. When optimising, hold back data the search never saw and prefer settings that stay profitable across periods over the single in-sample peak — chasing that peak is overfitting the noise. No default or preset here is a performance promise; every value is a starting point to re-validate on your own pair and broker.