McGinley Dynamic

The McGinley Dynamic is an adaptive moving average developed by John R. McGinley that automatically adjusts to market speed changes. Unlike traditional moving averages with fixed smoothing factors, it uses a dynamic adjustment mechanism that makes it more responsive during volatile periods while remaining smooth during trending markets. This self-adjusting nature helps reduce whipsaws and false signals common with standard moving averages.

What It Measures

The McGinley Dynamic measures the average price with automatic speed adjustment based on market volatility. The indicator adapts its smoothing factor using the fourth power of the price-to-indicator ratio, becoming more responsive when prices move sharply and smoother when trends are stable.

When to Use

Period Selection Guidelines

The period parameter affects responsiveness:

Period RangeCharacteristicsUse Case
10-15More responsive, tracks price closelyShort-term trading, quick trend changes
15-20Balanced (default 20)General trading, swing trading
20-30Smoother, filters minor fluctuationsPosition trading, clearer trends
30-50Very smooth, major trends onlyLong-term investing, macro trends

Interpretation

Default Usage

use rust_ti::moving_average::bulk::mcginley_dynamic;

pub fn main() {
    // fetch the data in your preferred way
    // let prices = vec![...];  // price data
    
    let period = 20;
    let previous_mcginley = 0.0;  // Use 0.0 for the first calculation
    
    let md = mcginley_dynamic(&prices, previous_mcginley, period);
    println!("McGinley Dynamic: {:?}", md);
}
import pytechnicalindicators as pti

# McGinley Dynamic with default period
period = 20
previous_mcginley = 0.0  # Use 0.0 for the first calculation

md = pti.moving_average.bulk.mcginley_dynamic(prices, previous_mcginley, period)
print("McGinley Dynamic:", md)
import init, { 
    ma_bulk_mcginleyDynamic
} from 'https://cdn.jsdelivr.net/npm/ti-engine@latest/dist/web/ti_engine.js';

await init();

// fetch the data in your preferred way
// const prices = [...];  // price data

const period = 20;
const previousMcginley = 0.0;  // Use 0.0 for the first calculation

const md = ma_bulk_mcginleyDynamic(prices, previousMcginley, period);
console.log("McGinley Dynamic:", md);

Interactive Chart

Use the interactive playground below to explore how different parameters affect the indicator's behavior.