Skip to content

McGinley Dynamic ​

Moving average that speeds up and slows down with the market.

Kind indicator · Drawn on the price pane

Try it ​

On the chart, press / and choose McGinley Dynamic under Moving averages. To change it, copy the source below into the AlphaScript editor.

Inputs ​

InputTypeDefault
Lengthint14
Sourcesource"close"
Colorcolor"#2962FF"

Source ​

From packages/alphascript/indicators/mcginley.as.js.

js
indicator({ name: "McGinley Dynamic", shortTitle: "McGinley", overlay: true });
const length = input.int("Length", 14, { min: 1 });
const src = input.source("Source", "close");
plot(ta.recur([src, ta.ema(src, length)], { mg: NaN }, (s, x, e) => (s.mg = s.mg !== s.mg ? e : s.mg + (x - s.mg) / (length * math.pow(x / s.mg, 4)))),
  { title: "McGinley", color: input.color("Color", "#2962FF", { group: "Style" }) });

AlphaScript language v0.1 · runtime 0.2.0