indicator · on price · open source

McGinley Dynamic

Deepwick · @deepwickv1Updated 2 Oct 2026▲ 0 users
Running…
Loading chart…

About

McGinley Dynamic is John Rung's attempt at a real-market-aware average that automatically speeds up in fast markets and slows in chop. Uses an adaptive denominator so the line never strays far from price for long.

  • More honest line than EMA/SMA on assets with rapid regime changes.
  • Raise N for steadier swings; the kernel already adapts internally.
  • Good single-line trend reference for indices and majors.

Source code

//@version=5
indicator("McGinley Dynamic", overlay=true)
len = input.int(14, "Length", minval=2, maxval=200)
src = input.source("close", "Source")
var float md = 0.0
md := nz(md[1], src) + (src - nz(md[1], src)) / (len * math.pow(src / nz(md[1], src), 4))
p_MD = plot(md, "MD", color=color.olive, linewidth=2)
alertcondition(ta.crossover(close, md), "Price crosses above MD", "Price crossed above the McGinley Dynamic")
alertcondition(ta.crossunder(close, md), "Price crosses below MD", "Price crossed below the McGinley Dynamic")

Comments

No comments yet.

Sign in to comment.