McGinley Dynamic Envelopes
Creates upper and lower envelope bands around the McGinley Dynamic moving average.
About the McGinley Dynamic Envelopes
McGinley Dynamic Envelopes creates upper and lower price envelopes around the McGinley Dynamic moving average at a constant difference. The McGinley Dynamic is a self-adjusting moving average developed by John R. McGinley that automatically adapts to market speed changes, making these envelopes more responsive to changing market conditions than traditional fixed moving average envelopes.
What It Measures
McGinley Dynamic Envelopes measures price bands at fixed distances above and below the McGinley Dynamic moving average. The indicator creates three lines: an upper envelope (McGinley Dynamic + difference), the middle line (McGinley Dynamic itself), and a lower envelope (McGinley Dynamic - difference), providing an adaptive channel that adjusts to market conditions.
There is no optimization here as the McGinley Dynamic Envelopes are themselves an optimization of traditional moving average envelopes.
When to Use
- Overbought/Oversold Identification: Price touching or breaking the upper envelope suggests potential overbought conditions; lower envelope suggests oversold
- Dynamic Support/Resistance: The envelope bands act as adaptive support and resistance levels that adjust to market volatility
- Trend Strength Assessment: The width between price and the bands indicates trend strength and potential exhaustion
- Breakout Confirmation: Price breaking through and staying beyond the envelopes may signal strong momentum
Interpretation
- Price at Upper Envelope: Potential overbought condition
- Price at Lower Envelope: Potential oversold condition
- Price Above Upper Envelope: Strong bullish momentum; breakout may continue or signal exhaustion
- Price Below Lower Envelope: Strong bearish momentum; breakdown may continue or signal capitulation
- Middle Line (McGinley Dynamic): Acts as dynamic support in uptrends and resistance in downtrends
- Adaptive Nature: The McGinley Dynamic automatically adjusts smoothing, making the envelopes more responsive during volatile periods and smoother during stable trends
- Crossing Middle Line: Price crossing the McGinley Dynamic center line can signal potential trend changes
Example Usage
use centaur_technical_indicators::candle_indicators::bulk::mcginley_dynamic_envelopes;
pub fn main() {
// fetch the data in your preferred way
// let close = vec![...]; // closing prices
let period = 20;
let difference = 3.0;
let previous_mcginley = 0.0; // Use 0.0 for the first calculation
let envelopes = mcginley_dynamic_envelopes(&close, difference, previous_mcginley, period);
println!("McGinley Dynamic Envelopes: {:?}", envelopes);
}
import centaur_technical_indicators as cti
# fetch the data in your preferred way
# close = [...] # closing prices
period = 20
difference = 3.0
previous_mcginley = 0.0 # Use 0.0 for the first calculation
envelopes = cti.candle_indicators.bulk.mcginley_dynamic_envelopes(
close,
difference,
previous_mcginley,
period
)
print("McGinley Dynamic Envelopes:", envelopes)
import init, {
candle_bulk_mcginleyDynamicEnvelopes
} from 'https://cdn.jsdelivr.net/npm/centaur-technical-indicators@latest/dist/web/centaur-technical-indicators.js';
await init();
// fetch the data in your preferred way
// const close = [...]; // closing prices
const period = 20;
const difference = 3.0;
const previousMcginley = 0.0; // Use 0.0 for the first calculation
const envelopes = candle_bulk_mcginleyDynamicEnvelopes(
close,
difference,
previousMcginley,
period
);
console.log("McGinley Dynamic Envelopes:", envelopes);