How to calculate the MACD in stock, what's the point?

Source: Internet
Author: User



         MACD called is developed from a double exponential moving average, with a fast exponential moving average (EMA12) minus the slow exponential moving average (EMA26) to get the fast line dif, then 2x (Fast line Dif-dif's 9th weighted moving average DEA) gets the MACD-histogram. The meaning of MACD and the double moving average are basically the same, that is, the dispersion of fast and slow moving averages, the aggregation of the current multi-empty state and the possible trend of stock price development, but easier to read. When the MACD shifts from negative to positive, it is the buy signal. When the MACD shifts from positive to negative, it is the signal to sell. When the MACD changes at a large angle, the gap between the fast moving average and the slow moving average is very rapid, representing a shift in the market trend.

In the calculation formula of the exponential smoothed moving average of MACD, we add the weight value of t+1 trading day respectively, taking the current popular parameters 12 and 26 as an example, the formula is as follows:

1. Calculate moving average (EMA)

12th The EMA's formula is

EMA (12) = Ema of the previous day (x11/13+) today's closing price X2/13

26th The EMA's formula is

EMA (26) = Ema of the previous day (x25/27+) today's closing price X2/27

2. Calculate the dispersion value (DIF)

dif= today EMA (12)-EMA today (26)

3.9th EMA for the calculation of DIF

today DEA (MACD) = Previous day deax8/10+ today DIFX2/10 the calculated dif and DEA values are positive or negative.

Use (Dif-dea) X2 is the MACD histogram.

So the MACD indicator is composed of two lines of a column formed, Fast Line for DIF, slow line for the DEA, histogram for MACD.

Its trading principles are:

1.DIF, Dea are positive, DIF breakthrough DEA, buy signal reference.

2.DIF, DEA are negative, DIF downward below the DEA, sell signal reference.

3.DIF line and Candlestick divergence, the market may appear reversal signal.

4.DIF, the DEA value from positive to negative, or from negative to positive is not a trade signal, because they lag behind the market.

Disadvantages:

⒈ because the MACD is a medium and long-term indicator, the price difference between the buy point, the sell point and the lowest price and the highest price is greater. When the market is too small or consolidation, according to the signal to enter after the appearance, there may be no profit between the sale, perhaps also to compensate for the spread of the price or fees.

⒉ within one or two days of a particularly large, macd too late reaction, because the movement of the MACD is quite moderate, the movement of the market has a certain time difference, so once the market quickly and sharply, the MACD will not immediately produce a signal, at this time, the MACD can not take effect.

 

The following will show you how to use the Python interface bAostock to get the daily candlestick information and draw the MACD line.


How to calculate the MACD in stock, what's the point?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.