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
- Trend Following: Identifies trend direction with fewer whipsaws than simple moving averages
- Dynamic Support/Resistance: Acts as adaptive support in uptrends and resistance in downtrends
- Crossover Strategies: Price crossing above/below signals potential trend changes with better timing
- Volatility Adaptation: Automatically adjusts to market conditions without parameter changes
- Alternative to EMAs: Provides smoother signals while maintaining responsiveness
Period Selection Guidelines
The period parameter affects responsiveness:
| Period Range | Characteristics | Use Case |
|---|---|---|
| 10-15 | More responsive, tracks price closely | Short-term trading, quick trend changes |
| 15-20 | Balanced (default 20) | General trading, swing trading |
| 20-30 | Smoother, filters minor fluctuations | Position trading, clearer trends |
| 30-50 | Very smooth, major trends only | Long-term investing, macro trends |
Interpretation
- Price Above McGinley Dynamic: Suggests bullish momentum; the indicator acts as dynamic support
- Price Below McGinley Dynamic: Suggests bearish momentum; the indicator acts as dynamic resistance
- Crossovers: Price crossing above the McGinley Dynamic can signal potential uptrend, while crossing below may signal downtrend
- Slope: The indicator's slope direction confirms trend strength and direction
- Adaptive Nature: The indicator automatically adjusts its responsiveness, requiring less manual tuning than traditional moving averages
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.