How it works
Every conventional moving average uses a fixed speed. A 20-period EMA applies the same smoothing factor whether the market is drifting sideways or collapsing, which produces the two failures traders complain about most: the line is too slow in a fast move and too twitchy in a quiet one. The McGinley Dynamic attacks that directly by making the speed a function of the gap between price and the line.
The mechanism is a self-adjusting divisor. Each bar the line moves toward price by a fraction, and that fraction is divided by the ratio of price to the line raised to the fourth power. When price runs far above the line, the ratio exceeds one, the fourth power magnifies it, the divisor grows and — counterintuitively — the line slows down. When price falls back toward the line, the ratio drops below one, the divisor shrinks and the line catches up quickly. The net effect is a line that refuses to chase a spike but tracks a steady trend tightly.
That asymmetry is the point. Its author argued that markets fall faster than they rise and that a fixed-speed average is therefore mis-specified in both directions, hugging price in slow markets and being left far behind in fast ones. The Dynamic behaves like a moving average whose effective length stretches automatically during a violent move and contracts during a calm one, without the user changing any setting.
In use it looks like a smoother, better-behaved EMA. Traders use it as a trend line and as a stop reference, and because it does not jump on a single bar it is noticeably less prone to whipsaw than an EMA of the same nominal length. Its practical weakness is the flip side: in a genuine, sustained repricing — a gap-driven collapse, for instance — the self-slowing divisor keeps it well away from price, and it will be late to acknowledge that the world has changed.
Against its neighbours: where the Hull average removes lag by extrapolating and accepts overshoot, the McGinley Dynamic removes lag by adapting speed and accepts being late on shocks. They fail in opposite directions, which is why some traders plot both.
Calculation
The arithmetic in words, in the order it happens.
Start the series at a simple moving average of the source. Then each bar, the new value equals the previous value plus the difference between the current price and the previous value, divided by N times the fourth power of the ratio of current price to the previous value. When price equals the line the divisor is simply N; when price is well above it the fourth power inflates the divisor and the line advances only slightly; when price is below it the divisor shrinks and the line moves down faster. Some implementations multiply N by a constant of roughly 0.6 to keep the responsiveness comparable to an exponential average of the same length, so values can differ between platforms.
Source
An AlgoBeamScript implementation of the formula above, written by us from the arithmetic so the code and the calculation agree line for line.
Runs unchanged on the platform and in the AlgoBeamTS runtime. The language reference is in the documentation.
Inputs
Defaults are the values most charting packages ship with. They are conventions, not optimal settings — the right length depends on your instrument and your holding period.
| Input | Default | What it changes |
|---|---|---|
| Length | 14 | The base speed before adaptation. It behaves like the length of a conventional average, but because the divisor scales with the price-to-line ratio, changing it has a milder effect than the same change on an EMA. |
| Source | Close | The price fed into the recursion. The fourth-power term makes the line sensitive to large single-bar deviations in a specific way — it slows down rather than jumping — so a noisy source degrades the line less than it would an EMA. |
How to read it
What practitioners take from the plot. Read these as descriptions of market state, not as entry signals.
- Price steadily above a rising Dynamic
- An orderly uptrend. Because the line self-adjusts, staying above it through several pullbacks is stronger evidence of trend health than the same behaviour around a fixed-speed average.
- Gap between price and the line widening quickly
- A fast move that the line is deliberately declining to chase. Expect the line to stay back until price consolidates — this is the adaptation working, not a lag fault.
- Line catching up rapidly as price returns
- The divisor has shrunk, so the Dynamic is closing the gap. Often the point at which a pullback and the trend line meet and the trend either resumes or fails.
- Price crossing and the line barely reacting
- A shallow cross with no momentum behind it. The Dynamic filters these better than an EMA, which is precisely why a cross that does move it carries more weight.
Limitations
Where this indicator misleads. None of these are fixed by a better parameter.
- It is late on genuine repricings. The same divisor that ignores a spike also ignores a real regime change, so after a large gap the line takes many bars to acknowledge the new level.
- Implementations disagree. Some include a constant near 0.6 in the divisor and some do not, so the same length on two platforms can plot visibly different lines — check before copying settings or backtest results.
- It is still a trend-following line and it still whipsaws in a range, just less often than an EMA. Adaptation reduces the problem; it does not remove it.
- The fourth power is an arbitrary choice with no derivation behind it. It works well empirically on liquid instruments, but there is no theory saying that exponent is correct, and on very low-priced instruments the ratio term behaves unevenly.
Educational reference. This page explains how an indicator is built and how it is commonly read. It is not investment advice, not a recommendation and not a signal service. No indicator is profitable on its own — each is a way of describing a market, and any rule built on one has to be tested with realistic costs before it is traded.