Close Menu
GeekBlog

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    Missouri or Kansas: Which Is Better for Raising a Family?

    September 4, 2026

    How to Measure and Analyze Marketing ROI

    September 4, 2026

    How to Use a Yoga Wheel in Your Workout (Safely)

    September 4, 2026
    Facebook X (Twitter) Instagram Threads
    GeekBlog
    • Home
    • Mobile
    • Tech News
    • Blog
    • Gaming
    • Smartwatch
    • How-To Guides
    • AI & Software
    Facebook
    GeekBlog
    Home»Blog»MACD Basics: How the Indicator Actually Works
    Blog

    MACD Basics: How the Indicator Actually Works

    Marcus BennettBy Marcus BennettSeptember 4, 20269 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Email Copy Link
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link

    MACD, short for Moving Average Convergence Divergence, measures the distance between two exponential moving averages of price and then smooths that distance again to produce a signal line. Gerald Appel developed it in the late 1970s and the standard settings have barely moved since: a 12 period EMA, a 26 period EMA and a 9 period EMA of the difference. Everything else you have read about MACD is interpretation layered on top of those three numbers.

    Quick answer: MACD Line = 12 period EMA of close minus 26 period EMA of close. Signal Line = 9 period EMA of the MACD Line. Histogram = MACD Line minus Signal Line. When the fast EMA pulls away from the slow one, the MACD Line rises and the averages are diverging. When they close in on each other, it falls and they are converging. The zero line is where the two EMAs are equal.

    The name is literal, which is unusual for a technical indicator, and reading it literally solves most of the confusion. MACD is not measuring momentum in the physics sense and it is not measuring strength. It is measuring the gap between two smoothed prices, and the rate at which that gap is changing.

    The formula

    An exponential moving average weights recent data more heavily using a smoothing factor of 2 divided by (N + 1). For the three periods MACD uses, that gives the multipliers below.

    ComponentPeriodSmoothing factorApplied to
    Fast EMA120.1538Closing price
    Slow EMA260.0741Closing price
    Signal Line90.2000The MACD Line

    The update rule is the same for all three: new EMA equals the previous EMA plus the smoothing factor multiplied by (current value minus previous EMA). The signal line is the only one that takes the MACD Line rather than price as its input, which is why it always trails.

    import pandas as pd
    
    def macd(close, fast=12, slow=26, signal=9):
        ema_fast = close.ewm(span=fast, adjust=False).mean()
        ema_slow = close.ewm(span=slow, adjust=False).mean()
        line   = ema_fast - ema_slow
        sig    = line.ewm(span=signal, adjust=False).mean()
        return line, sig, line - sig
    
    df["macd"], df["signal"], df["hist"] = macd(df["close"])
    Note: Use adjust=False in pandas. The default adjust=True computes a different weighting for the early rows and will not match what your charting platform draws until well past the warmup period. This single argument accounts for a large share of the reports that pandas MACD is broken.

    A worked example

    Five bars, with the two price EMAs already computed so the interesting arithmetic is visible. The signal line uses a smoothing factor of 0.2, and the first signal value is seeded at 0.70.

    BarEMA 12EMA 26MACD LineSignal LineHistogram
    1101.20100.101.100.700.40
    2101.55100.281.270.810.46
    3101.80100.501.300.910.39
    4101.60100.660.940.920.02
    5101.30100.750.550.840.29 negative

    Follow bar 2 by hand to confirm the mechanics. The MACD Line is 101.55 less 100.28, which is 1.27. The signal line is the previous 0.70 plus 0.2 multiplied by (1.27 less 0.70), giving 0.814. The histogram is 1.27 less 0.814, or 0.46.

    Recommended for you:

    Blog·Sep 4, 2026

    Building a WordPress Plugin From Scratch (Advanced)

    Now look at the sequence. The histogram peaks on bar 2 at 0.46 and shrinks from bar 3 onward, but the signal line crossover does not happen until bar 5. The histogram turned three bars before the cross. That is the entire practical argument for watching the histogram rather than the crossover, and also the entire practical argument against it, because a shrinking histogram very often recovers without a cross ever occurring.

    The histogram

    The histogram plots MACD Line minus Signal Line as bars around zero. It was not part of Appel’s original presentation. Thomas Aspray introduced it and wrote about its use in Technical Analysis of Stocks & Commodities magazine, and it has been standard on charting platforms ever since.

    What it actually shows is the second derivative of the underlying relationship: not whether the EMAs are diverging, but whether that divergence is accelerating or decelerating. A histogram above zero and growing means the fast EMA is pulling away faster. Above zero and shrinking means the move is losing pace while still being an uptrend by every other MACD measure. Crossing zero is identical to a signal line crossover, so it adds nothing new at that exact moment.

    The four common readings

    ReadingWhat it means mechanicallyMain weakness
    Signal line crossMACD Line crosses its own 9 period EMAFires constantly in a range, always late in a trend
    Zero line crossThe 12 and 26 period EMAs have swapped orderSlower than the signal cross, so entries are worse
    DivergencePrice makes a new extreme, MACD does notPersists for many bars, resolves without reversal often
    Histogram turnRate of divergence starts fallingEarliest and noisiest of the four by a wide margin

    Notice that the four are ordered from latest to earliest, and that lateness and reliability move together. There is no configuration that gives you both. Choosing among them is choosing where on that tradeoff you want to sit, and the correct answer depends on your holding period and your tolerance for false starts, not on which one is objectively best.

    What MACD cannot tell you

    Three limitations are structural rather than fixable by tuning.

    It lags by construction. Every component is an average of past prices, and the signal line is an average of an average. By the time a crossover prints, a meaningful part of the move has already happened. Shortening the periods reduces the lag and increases the false signals in exact proportion.

    It has no fixed scale. MACD is expressed in the price units of the instrument, so a reading of 2.40 means something entirely different on a 40 dollar stock than on a 4,000 dollar index. You cannot compare MACD values across securities, and a level that looked extreme last year may be ordinary after the price has doubled.

    It sees only closing prices. Gaps, intrabar ranges and volume are all invisible to it. A volatility measure such as Average True Range or a flow measure such as the Money Flow Index covers information MACD is structurally blind to.

    What the evidence supports

    Be skeptical of any article that quotes a MACD win rate without naming the market, the sample period and the transaction cost assumption. Those numbers are almost always produced by fitting a rule to a chart after the fact.

    The peer reviewed picture is genuinely mixed. Brock, Lakonishok and LeBaron found statistically significant results for simple moving average and range breakout rules on the Dow between 1897 and 1986, published in the Journal of Finance in 1992. Sullivan, Timmermann and White then re ran that same rule universe in the Journal of Finance in 1999 using a bootstrap that corrects for data snooping, and the apparent edge did not hold in the period following the original sample. Bajgrowicz and Scaillet applied a false discovery rate framework in the Journal of Financial Economics in 2012 and reached a comparable conclusion once realistic costs were applied. Park and Irwin’s survey counted 95 modern studies, 56 positive, 20 negative, 19 mixed, and flagged data snooping as the central problem with that tally.

    MACD is a moving average crossover rule with extra smoothing, so it sits squarely inside the family those papers examined. Treat it as a compact description of trend state and rate of change, which it does well, rather than as a source of edge.

    Common problems and fixes

    ProblemCauseFix
    Your values differ from the platformEMA seeded differently, or adjust=True in pandasSet adjust=False and discard the first 50 or so bars.
    Crossovers every few barsThe market is rangingAdd a trend filter and ignore crosses near the zero line.
    Divergence signal failed repeatedlyStrong trends produce continuous divergenceRequire price structure confirmation before acting on it.
    MACD unreadable after a stock splitPrice units changed, history not adjustedUse a split adjusted series, or use percentage price oscillator instead.

    Frequently asked questions

    What are the best MACD settings?

    12, 26 and 9 remain the default and there is no evidence that alternatives are better in general. Faster settings such as 5, 35 and 5 produce earlier and noisier signals. Pick a configuration before testing and hold it fixed, because tuning periods against past data is the fastest route to a backtest you cannot trade.

    What is the difference between MACD and the histogram?

    Recommended for you:

    Blog·Sep 4, 2026

    How to Create a WordPress Plugin: Beginner Tutorial

    The MACD Line is the gap between two price EMAs. The histogram is the gap between the MACD Line and its own signal line. The histogram therefore turns earlier, since it reacts to changes in the rate of divergence rather than to the divergence itself.

    Does MACD work on intraday charts?

    The math applies to any bar interval, but the signal to noise ratio degrades sharply below about 15 minutes, because the EMAs are then dominated by microstructure rather than direction. If you use it intraday, add a session filter and expect far more false crossovers than on daily bars.

    Is MACD a leading or lagging indicator?

    Lagging. Every input is a moving average of past closes, so it can only describe what has already happened. The histogram is sometimes called leading because it turns before the crossover, but that is leading relative to the crossover, not relative to price.

    Should I combine MACD with other indicators?

    Yes, provided you add something that measures a different thing. Pairing MACD with another moving average system gives you two views of the same information. Pairing it with volatility bands such as Keltner Channels or with a projected structure like the Ichimoku Cloud is more informative.

    The bottom line

    MACD earned its place because it compresses a lot into one panel: trend direction from the zero line, trend strength from the distance, and rate of change from the histogram. The arithmetic is three exponential averages and two subtractions, and you can verify any bar of it by hand in under a minute.

    It is also late by design, unbounded in scale, and blind to volume and gaps. Those are not settings problems. Use MACD to describe where a trend stands, use other tools to decide whether to act, and do not trust a published win rate that arrives without a dataset attached.

    Warning: This article is educational information about indicator mechanics and is not investment advice. It does not recommend any security, setting or strategy, and no technical indicator predicts future prices. Trading involves a substantial risk of loss. Consult a licensed financial professional before making investment decisions.
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Telegram Email Copy Link
    Previous ArticleHow to Interpret the Ichimoku Cloud in Trading
    Next Article Building a WordPress Plugin From Scratch (Advanced)
    Marcus Bennett

      Marcus Bennett is GeekBlog's Android expert, covering everything from Google's Pixel line and Samsung Galaxy flagships to OnePlus, Nothing, Xiaomi and the broader Android ecosystem. He follows each Android OS release, One UI and Pixel Feature Drop, custom ROMs and the foldable wave, translating spec sheets and beta builds into hands-on guidance for readers choosing their next Android phone, tablet or wearable.

      Related Posts

      10 Mins Read

      Missouri or Kansas: Which Is Better for Raising a Family?

      11 Mins Read

      How to Measure and Analyze Marketing ROI

      10 Mins Read

      How to Use a Yoga Wheel in Your Workout (Safely)

      10 Mins Read

      Best States to Invest in Real Estate: 5 Top Picks

      9 Mins Read

      Why Promote Someone Else’s Content? The Case for Curation

      10 Mins Read

      How to Retrieve Facebook Page Insights and Analytics Data

      Top Posts

      How to Change HEIC to JPG on iPhone, Mac, Android and Windows (No Software Needed)

      September 3, 20263 Views

      How to Spot AI Generated Images in 2026 (The Old Tricks Stopped Working)

      September 3, 20262 Views

      Check Which Apps Can Read Your Gmail, and Cut Them Off in 60 Seconds

      September 3, 20262 Views
      Stay In Touch
      • Facebook

      Subscribe to Updates

      Get the latest tech news from FooBar about tech, design and biz.

      Most Popular

      A Toddler Needed a $20,000 Wheelchair. A High School Robotics Team Built Him One Instead.

      August 5, 20264 Views

      How to Change HEIC to JPG on iPhone, Mac, Android and Windows (No Software Needed)

      September 3, 20263 Views

      The EU AI Act Just Became Enforceable, and Most AI Companies Are Not Ready

      August 6, 20263 Views
      Our Picks

      Missouri or Kansas: Which Is Better for Raising a Family?

      September 4, 2026

      How to Measure and Analyze Marketing ROI

      September 4, 2026

      How to Use a Yoga Wheel in Your Workout (Safely)

      September 4, 2026

      Subscribe to Updates

      Get the latest creative news from FooBar about art, design and business.

      HEICJPG.online - Convert HEIC to JPG online
      Facebook
      • About Us
      • Contact us
      • Privacy Policy
      • Disclaimer
      • Terms and Conditions
      • Editorial Policy
      • Cookie Policy
      © 2026 GeekBlog

      Type above and press Enter to search. Press Esc to cancel.