Trend indicators

McGinley Dynamic Indicator: Formula, Settings and a Test Against the EMA in 1987

The McGinley Dynamic adjusts its speed to the gap between price and the line, falling fast when price drops below it and rising slowly when price is above. Here is John McGinley's formula, the N setting he suggested, and how it compared with a 20-day EMA through the rise, the crash and the range of 1987 and 1988.

· Founder of PatternsWizard
Checked 8 min read
McGinley Dynamic(12) and EMA(20) on S&P 500 index, daily, October 7, 1987 to December 31, 1987. Illustration of how the indicator reads, not a backtest.
On this page
  1. How the McGinley Dynamic is calculated
  2. Which N to use
  3. McGinley Dynamic against an EMA: a crash, a rise and a range
  4. How traders use it
  5. Does it work?
  6. Tested on our bench
  7. Frequently asked questions

Every pattern's results on one sheet

The only pattern cheat sheet with tested stats: 153 patterns, what the textbook says and what really happened on 6 markets. Free PDF, sent to your inbox.

The PDF by email, plus our newsletter: new tests and results that change. Unsubscribe anytime. Privacy.

The McGinley Dynamic is a price-tracking line designed by market technician John R. McGinley to follow price more closely than a moving average. It looks like one, but its step size changes with the gap between price and the line: it speeds up when price runs away below it and slows down when price runs above it. McGinley first outlined it in the Market Technicians Association's Journal of Technical Analysis in 1991 and published the full study there in 1997, according to Brian Twomey's 2010 article in Stocks & Commodities.

McGinley Dynamic and 20-day EMA on the S&P 500 in 1987

McGinley Dynamic(12) and EMA(20) on S&P 500 index, daily, January 7, 1987 to December 31, 1987. Illustration of how the indicator reads, not a backtest.
  • Price, daily candles (hollow up, filled down)
  • McGinley Dynamic, N = 12 (solid line)
  • EMA(20) of the close, for comparison (dashed line)
McGinley Dynamic(12) and EMA(20) on S&P 500 index, daily, January 7, 1987 to December 31, 1987. Illustration of how the indicator reads, not a backtest.

How the McGinley Dynamic is calculated

Each new value moves the previous one toward the price by a fraction of the gap. In a plain exponential average that fraction is fixed. In the Dynamic it is divided by the fourth power of the ratio between price and the line.

When price is below the line, the ratio is under 1, its fourth power is smaller still, and the step grows: the line drops quickly. When price is above, the ratio is over 1 and the step shrinks: the line rises slowly.

Share of the gap closed in one step, McGinley Dynamic (12) vs. EMA (20)

Share of the gap closed in one step, McGinley Dynamic (12) vs. EMA (20). Price 20% below the line (ratio 0.8): 20.35%; Price 10% below (ratio 0.9): 12.70%; Price on the line (ratio 1): 8.33%; Price 10% above (ratio 1.1): 5.69%; Price 20% above (ratio 1.2): 4.02%; EMA (20), at any ratio: 9.52%. Our computation; the inputs and the method are in the text.
Our computation; the inputs and the method are in the text.The Dynamic moves by 1 / (12 × ratio⁴) of the gap at each bar; the EMA (20) always by 2 / 21. Below the line the Dynamic steps faster than the EMA, above it slower.

LuxAlgo explains this asymmetry by McGinley's reasoning that “markets fall faster than they rise”, and stresses that, strictly, “it is not a moving average at all”, since no fixed window of prices is averaged.

Which N to use

LuxAlgo reports McGinley's suggestion to set N to roughly 60% of the moving average length you would otherwise use. That is why the chart pairs a Dynamic of 12 with a 20-day EMA. Using the same number for both does not give the same speed. With N = 20, on the same 1987 data, the Dynamic stayed on average 3.81% away from the close during the rise of January to August, against 2.05% for the EMA(20): it was the slower line of the two.

McGinley Dynamic against an EMA: a crash, a rise and a range

We measured, on the daily S&P 500 index, the average distance between the close and each line, as a percentage of the close, and how many times the close crossed the line, in three phases: the rise from January to August 1987, the fall from October 1 to November 30, 1987, and the range from February to June 1988.

Average distance between the close and each line, S&P 500, 1987 to 1988

Average distance between the close and each line, S&P 500, 1987 to 1988. Rise, Jan. 2 to Aug. 31, 1987: McGinley Dynamic (12) 2.54%, EMA (20) 2.05%; Fall, Oct. 1 to Nov. 30, 1987: McGinley Dynamic (12) 4.34%, EMA (20) 7.14%; Range, Feb. 1 to June 30, 1988: McGinley Dynamic (12) 1.95%, EMA (20) 1.71%. Our computation; the inputs and the method are in the text.
  • McGinley Dynamic (12)
  • EMA (20)
Our computation; the inputs and the method are in the text.Mean of |close − line| / close over the sessions of each phase: the lower bar is the line that tracked price more closely.

Bars and crossings: the rise counts 168 sessions, with 9 crossings of the Dynamic against 13 of the EMA; the fall, 42 sessions, with 5 against 1; the range, 106 sessions, with 10 against 12. A crossing is a session whose close sits on the other side of the line from the previous close. Both lines run on daily closes and start from the simple average of the first N closes of the series, which begins on January 2, 1986, so they are fully warmed up by 1987.

The Dynamic did what it was designed for in the fall: it stayed much closer to price than the EMA. It did not track better in the rise or in the range, where the EMA was closer, as the formula's asymmetry predicts. Closer tracking also means more crossings in a fast market: 5 against 1 in the fall.

The signals that came out of it need the full story. The index made its record close of 336.77 on August 25, 1987. The close fell below the EMA on August 28 (327.04), back above it on August 31, and below both lines on September 1 (323.40); it crossed back above both in mid-September, and fell below both for the last time before the crash on October 6, at 319.22, nine sessions before October 19. After the crash, the close went back above the Dynamic on November 2, at 255.75, against the line at 253.94, then crossed it three more times that week and ended it below the line on November 6. That was early: the index then fell to its lowest close of the period, 223.92, on December 4, 12.45% lower. The close went back above both lines on December 9, at 238.89, fell below them the next day and crossed above both again on December 14, at 242.19. By June 30, 1988 the index stood at 273.50, 6.94% above the November 2 signal and 14.49% above the December 9 one.

S&P 500 after each up-cross of the Dynamic (12), late 1987

S&P 500 after each up-cross of the Dynamic (12), late 1987. Nov 2, 1987 cross, to the Dec 4 low: −12.45%; Nov 2, 1987 cross, to June 30, 1988: +6.94%; Dec 9, 1987 cross, to June 30, 1988: +14.49%; Dec 14, 1987 cross, to June 30, 1988: +12.93%. Our computation; the inputs and the method are in the text.
Our computation; the inputs and the method are in the text.Change from the close of the up-cross session to the close of the later date, daily S&P 500 index. Four signals in one market: an illustration, not a test.

On daily Bitcoin, over the last 250 days to October 28, 2026, the Dynamic (12) was on average 3.88% away from the close against 3.34% for the EMA (20), with 32 crossings against 36: over that window the Dynamic was the more distant line.

How traders use it

  • As a trend line: price above the line read as an uptrend, below as a downtrend.
  • As a trailing reference: the line as a level for a stop in a falling market, where it follows price closely.
  • In place of a moving average in a crossover rule, with N set to about 60% of the average's length (see moving average crossover).

Does it work?

On our data, the Dynamic followed price better than an EMA during a crash and worse during a rise and a range, which is what its formula implies; it does not show a trading edge. Our bench tested price crossings of the Dynamic across markets after costs: buying them lagged the market, and selling them lagged it by a small, fragile margin; the results are in the section below (see our methodology). Other attempts at a faster average are the Hull moving average and the ALMA; the plain versions are on the moving average page, and the 1987 market itself is on Black Monday. More tools are listed with the trend indicators.

Data from our test bench

Tested on our bench

We coded the 2 strategies taught on this page, buy and sell side, and ran them on stocks, ETFs, indices, forex, crypto and commodities. With all markets pooled (daily bars): 2 did worse than the market.

Price crosses the McGinley Dynamic, bullishLagged the market

Entry: Close crosses above McGinley Dynamic(14). Exit: Opposite signal (stop and reverse).

The trade itself made money on average, but less than the rest of the market over the same bars.

In detail, all markets pooled

On daily bars, the rule fired 603,442 times on 2,343 assets (stocks, ETFs, indices, currency pairs, crypto pairs and commodity futures) between 1970 and 2026, about once every 14 bars on each asset.

The average trade returned +0.36% before costs and the median trade −1.04%; 27% of trades made money, and the gains added up to 1.21 times the losses.

A trade lasted 3 bars at the median, half of them between 1 and 10 bars.

Over exactly the same bars, compared with an equal-weight basket of the other assets of the same market, the trades ended −0.21% per trade after costs (95% interval −0.24% to −0.17%).

Signals
603,4422,343 assets, 1970 to 2026
Average trade
+0.36%before costs; median −1.04%
Winning trades
27%profit factor 1.21
Median hold
3 barshalf between 1 and 10
Vs the market, after costs
−0.21%95% interval −0.24% to −0.17%

After the signal, bar by bar

Share of signals where the price had moved in the signal’s direction after N bars, against the same assets at random dates (before costs).

Bars after1351020
After the signal50.0%51.9%52.1%53.4%54.6%
Random dates50.6%51.9%52.6%53.6%54.6%

Over time

The history cut into three periods with the same number of signals: gap per trade against the rest of the market, before costs.

PeriodSignalsVs market, before costs
1970 to 2012201,169−0.11%
2012 to 2021201,225−0.09%
2021 to 2026201,048−0.11%

Stress tests

The same trades, measured again under harsher assumptions (vs market, after costs).

VariantVs marketResult
As tested: entry at the signal close, standard costs−0.21%
Entry at the next bar's open−0.23%Holds
Trading costs doubled−0.31%Holds
1% most extreme trades trimmed on each side−0.36%Holds

With the trade we run on chart patterns instead (stop at 2 ATR, target at twice the risk, entry at the signal close), 38% of 600,595 trades hit the target first, for +0.16 R per trade on average against +0.15 R for the same trade at random dates of the same assets: no measurable difference from random dates.

Worst single trade of the whole test: −68.0% on CYN, signal of 2025-02-10.

Real trades from the test

Taken from the test itself on well-known assets: the indicator lines are the values the bench computed for that signal, the shaded zone is the time in the trade, from the signal close to the exit. Best and worst are chosen among these assets, not over the whole test.

Price crosses the McGinley Dynamic, bullish: real trade on NEAR/USDT, 2026-07-20, daily chart
Most recentNEAR 2026-07-20 daily chartBought at the close of 2026-07-20 (1.98), sold 1 bar later, when the exit rule fired (1.94): −2.1% before costs.Against the other crypto pairs over the same bars, after costs: −2.0%.McGinley Dynamic
Price crosses the McGinley Dynamic, bullish: real trade on SOL/USDT, 2020-12-28, daily chart
Best tradeSOL 2020-12-28 daily chartBought at the close of 2020-12-28 (1.52), sold at the maximum holding time, 100 bars later (26.54): +1,649.2% before costs.Against the other crypto pairs over the same bars, after costs: +96.8%.McGinley Dynamic
Price crosses the McGinley Dynamic, bullish: real trade on CYN, 2025-02-10, daily chart
Worst tradeCYN 2025-02-10 daily chartBought at the close of 2025-02-10 (27.75), sold 5 bars later, when the exit rule fired (8.88): −68.0% before costs.Against the other stocks over the same bars, after costs: −68.3%.McGinley Dynamic
Price crosses the McGinley Dynamic, bullish: real trade on SLG, 2008-08-08, daily chart
Typical tradeSLG 2008-08-08 daily chartBought at the close of 2008-08-08 (41.44), sold 7 bars later, when the exit rule fired (41.03): −1.0% before costs.Against the other stocks over the same bars, after costs: +0.4%.McGinley Dynamic

Market by market

MarketBarsSignalsAvg tradeWinnersVs market, after costsResult
Stocksdaily523,270+0.32%27%−0.19%Lagged the market
ETFsdaily19,070+0.20%30%−0.08%No edge found
Indicesdaily9,718+0.42%32%n/aNot measured
Forexdaily6,943−0.02%26%−0.06%No edge found
Cryptodaily38,827+1.04%19%−0.51%Inconclusive
Commoditiesdaily5,614+0.29%27%−0.16%No edge found
All markets4-hour317,243+0.004%23%−0.29%Lagged the market
Forex4-hour38,727−0.01%25%−0.04%Inconclusive
Crypto4-hour278,516+0.01%23%−0.32%Lagged the market
All marketsweekly85,098+2.92%29%−0.39%No edge found
Stocksweekly74,610+2.91%29%−0.39%No edge found
ETFsweekly3,290+1.88%34%−0.09%No edge found
Indicesweekly1,772+2.39%36%−0.23%No edge found
Forexweekly1,404−0.21%25%−0.25%Lagged the market
Cryptoweekly2,883+9.85%17%n/aNot measured
Commoditiesweekly1,139+1.96%24%−0.68%No edge found
Price crosses the McGinley Dynamic, bearishLagged the market, fragile

Entry: Close crosses below McGinley Dynamic(14). Exit: Opposite signal (stop and reverse).

In detail, all markets pooled

On daily bars, the rule fired 607,679 times on 2,346 assets (stocks, ETFs, indices, currency pairs, crypto pairs and commodity futures) between 1970 and 2026, about once every 14 bars on each asset.

The average trade returned −0.36% before costs and the median trade −1.11%; 24% of trades made money, and the gains added up to only 0.79 times the losses. For this sell signal, a trade gains when the price falls (a short sale).

A trade lasted 3 bars at the median, half of them between 1 and 7 bars.

Over exactly the same bars, compared with an equal-weight basket of the other assets of the same market, the trades ended −0.17% per trade after costs (95% interval −0.19% to −0.14%). For a sell signal, a positive number means the asset did worse than the others, as the signal announced.

Signals
607,6792,346 assets, 1970 to 2026
Average trade
−0.36%before costs; median −1.11%
Winning trades
24%profit factor 0.79
Median hold
3 barshalf between 1 and 7
Vs the market, after costs
−0.17%95% interval −0.19% to −0.14%

After the signal, bar by bar

Share of signals where the price had moved in the signal’s direction after N bars, against the same assets at random dates (before costs).

Bars after1351020
After the signal47.5%47.4%46.5%45.9%45.3%
Random dates48.2%47.4%47.0%46.2%45.3%

Over time

The history cut into three periods with the same number of signals: gap per trade against the rest of the market, before costs.

PeriodSignalsVs market, before costs
1970 to 2012202,627−0.05%
2012 to 2021202,569−0.04%
2021 to 2026202,483−0.10%

Stress tests

The same trades, measured again under harsher assumptions (vs market, after costs).

VariantVs marketResult
As tested: entry at the signal close, standard costs−0.17%
Entry at the next bar's open−0.13%Does not hold
Trading costs doubled−0.27%Holds
1% most extreme trades trimmed on each side−0.19%Holds

The result no longer holds when entering at the next bar's open instead of the signal close.

With the trade we run on chart patterns instead (stop at 2 ATR, target at twice the risk, entry at the signal close), 28% of 603,744 trades hit the target first, for −0.15 R per trade on average against −0.15 R for the same trade at random dates of the same assets: no measurable difference from random dates.

Worst single trade of the whole test: −280.5% on REQ/USDT, signal of 2021-11-24.

Real trades from the test

Taken from the test itself on well-known assets: the indicator lines are the values the bench computed for that signal, the shaded zone is the time in the trade, from the signal close to the exit. Best and worst are chosen among these assets, not over the whole test.

Price crosses the McGinley Dynamic, bearish: real trade on ETC/USDT, 2026-07-18, daily chart
Most recentETC 2026-07-18 daily chartSold short at the close of 2026-07-18 (7.01), bought back 8 bars later, when the exit rule fired (7.10): −1.3% before costs.Against the other crypto pairs over the same bars, after costs: −0.6%.McGinley Dynamic
Price crosses the McGinley Dynamic, bearish: real trade on CHEF, 2020-02-13, daily chart
Best tradeCHEF 2020-02-13 daily chartSold short at the close of 2020-02-13 (37.63), bought back 24 bars later, when the exit rule fired (4.85): +87.1% before costs.Against the other stocks over the same bars, after costs: +79.0%.McGinley Dynamic
Price crosses the McGinley Dynamic, bearish: real trade on QURE, 2025-09-15, daily chart
Worst tradeQURE 2025-09-15 daily chartSold short at the close of 2025-09-15 (14.84), bought back 7 bars later, when the exit rule fired (47.50): −220.2% before costs.Against the other stocks over the same bars, after costs: −220.6%.McGinley Dynamic
Price crosses the McGinley Dynamic, bearish: real trade on LGND, 2017-02-28, daily chart
Typical tradeLGND 2017-02-28 daily chartSold short at the close of 2017-02-28 (65.27), bought back 4 bars later, when the exit rule fired (65.98): −1.1% before costs.Against the other stocks over the same bars, after costs: −1.3%.McGinley Dynamic

Market by market

MarketBarsSignalsAvg tradeWinnersVs market, after costsResult
Stocksdaily525,999−0.42%23%−0.15%Lagged the market, fragile
ETFsdaily19,065−0.27%23%−0.07%No edge found
Indicesdaily9,715−0.11%25%n/aNot measured
Forexdaily6,944−0.04%25%−0.06%No edge found
Cryptodaily40,321+0.18%31%−0.47%Lagged the market
Commoditiesdaily5,635−0.18%25%−0.17%No edge found
All markets4-hour319,426−0.05%26%−0.28%Lagged the market
Forex4-hour39,816−0.01%25%−0.04%Inconclusive
Crypto4-hour279,610−0.05%26%−0.31%Lagged the market
All marketsweekly86,979−1.38%22%−0.23%Lagged the market
Stocksweekly75,721−1.44%22%−0.22%Inconclusive
ETFsweekly3,301−0.72%22%−0.05%No edge found
Indicesweekly1,774−0.39%24%−0.22%No edge found
Forexweekly1,405−0.21%26%−0.20%No edge found
Cryptoweekly3,635−2.64%30%n/aNot measured
Commoditiesweekly1,143−1.00%23%−0.74%Inconclusive

Each strategy enters at the close of the signal bar and exits at the exit it teaches, without a stop. The test compares the asset with an equal-weight basket of the other assets of its market over exactly the same bars, net of trading costs; for a sell signal, beating the market means the asset did worse than the others. A result is shown as beating or lagging the market only when it survives a correction for the number of tests and holds in both halves of the history; it is marked fragile when entering at the next open, doubling costs or trimming extreme trades removes it. Daily index bars are not compared with other indices, because their closes fall at different hours; “Not measured” also covers samples too small to test. Rules were fixed before any result was seen. How we test

Frequently asked questions

What is the McGinley Dynamic formula?

MD = previous MD + (price − previous MD) / (N × (price / previous MD)⁴). The fourth power makes the line step faster when price is below it and slower when price is above it.

What is the best setting for the McGinley Dynamic?

There is no tested best value. McGinley's own suggestion, as reported by LuxAlgo, is about 60% of the moving average length you would otherwise use, for example 12 in place of a 20-day average.

Is the McGinley Dynamic better than an EMA?

It tracks price more closely in a fast fall and less closely in a rise. On the S&P 500 in 1987, it was closer than a 20-day EMA during the crash and further away during the rise and the 1988 range.

Who created the McGinley Dynamic?

John R. McGinley, a market technician, who published it in the Market Technicians Association's Journal of Technical Analysis: an outline in 1991 and a full study in 1997.

Sources

  1. Brian Twomey, The McGinley Dynamic, Technical Analysis of Stocks & Commodities, March 2010
  2. LuxAlgo Library, McGinley Dynamic
  3. TradingView Help Center, McGinley Dynamic
, Founder of PatternsWizard

Passionate about finance, quantitative trading and data analysis. Amaury built the PatternsWizard test bench, which detects each pattern on full price history and measures what happened next against random entries.

PatternsWizard tests chart and candlestick patterns on full market history, against random entries. How we test patterns.

179 patterns testedRandom-walk self-test passed

All trend indicators articles