Watch how to download trading robots for free
Find us on Telegram!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Views:
40744
Rating:
(34)
Published:
2010.01.26 11:15
Updated:
2016.11.22 07:32
macd.mq5 (4.86 KB) view
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

Moving Average Convergence/Divergence (MACD) is the next trend-following dynamic indicator. It indicates the correlation between two Moving Averages of a price.

The Moving Average Convergence/Divergence (MACD) Technical Indicator is the difference between a 26-period and 12-period exponential moving averages (EMA). In order to clearly show buy/sell opportunities, a so-called signal line (9-period moving average of the indicator) is plotted on the MACD chart.

The MACD proves most effective in wide-swinging trading markets. There are three popular ways to use the Moving Average Convergence/Divergence: crossovers, overbought/oversold conditions, and divergences.

  1. Crossovers. The basic MACD trading rule is to sell when the MACD falls below its signal line. Similarly, a buy signal occurs when the Moving Average Convergence/Divergence rises above its signal line. It is also popular to buy/sell when the MACD goes above/below zero.
  2. Overbought/Oversold Conditions. The MACD is also useful as an overbought/oversold indicator. When the shorter moving average pulls away dramatically from the longer moving average (i.e., the MACD rises), it is likely that the security price is overextending and will soon return to more realistic levels.
  3. Divergence. An indication that an end to the current trend may be near occurs when the MACD diverges from the security. A bullish divergence occurs when the Moving Average Convergence/Divergence indicator is making new highs while prices fail to reach new highs. A bearish divergence occurs when the MACD is making new lows while prices fail to reach new lows. Both of these divergences are most significant when they occur at relatively overbought/oversold levels.

MACD indicator

MACD indicator

Calculation:

The MACD is calculated by subtracting the value of a 26-period exponential moving average from a 12-period exponential moving average. A 9-period dotted simple moving average of the MACD (the signal line) is then plotted on top of the MACD.

MACD = EMA(CLOSE, 12) - EMA(CLOSE, 26)
SIGNAL = SMA(MACD, 9)

where:

Translated from Russian by MetaQuotes Ltd.
Original code: https://www.mql5.com/ru/code/35

Ichimoku Kinko Hyo Ichimoku Kinko Hyo

The Indicator Ichimoku Kinko Hyo is predefined to characterize the market Trend, Support and Resistance Levels, and to generate signals of buying and selling.

Heiken-Ashi Heiken-Ashi

The Heiken-Ashi indicator is looks like the candlestick chart, but it has some difference.The advantage of the Heiken-Ashi charts is a simple trend determination, the upward trend candles are blue,the downward trend candles are red.

Market Facilitation Index (BW MFI) Market Facilitation Index (BW MFI)

The Market Facilitation Index (BW MFI) is the indicator which shows the change of price for one tick.

ColorCandlesDaily ColorCandlesDaily

The ColorCandlesDaily indicator draws candles with different colors depending on the day of the week.