McGinley Dynamic Bands
Adaptive price bands using McGinley Dynamic for dynamic support and resistance levels.
About the McGinley Dynamic Bands
McGinley Dynamic Bands creates upper and lower price bands around price at a volatility-based distance, using a deviation model and multiplier around the McGinley Dynamic as the smoothing baseline.
What It Measures
McGinley Dynamic Bands measure adaptive price channels that create dynamic support and resistance levels using the McGinley Dynamic for smoothing. The indicator establishes upper and lower bands using a deviation model (for example, standard deviation) and a deviation multiplier, so the band width expands during high volatility and contracts during low volatility, while the McGinley Dynamic's self-adjusting mechanism responds to market speed changes, making the bands more reactive during volatile periods and more stable during consolidation.
There is no separate optimization analysis here, as using the McGinley Dynamic as the smoothing engine is itself an optimization over traditional moving average band calculations.
When to Use
- Trend Identification: Price position relative to the bands helps confirm trend direction and strength
- Dynamic Support/Resistance Detection: Bands act as adaptive support and resistance levels that adjust to market conditions
- Volatility Assessment: Band width relative to price provides insight into current volatility levels
- Breakout Signal Detection: Price breaks beyond the bands may signal strong momentum or trend changes
- Price Channel Trading: The bands define trading channels for range-bound and trending strategies
Interpretation
- Price at Upper Band: Potential resistance level; consider taking profits, reducing positions, or waiting for pullback before entering
- Price at Lower Band: Potential support level; consider buying opportunities or covering short positions
- Price Breaking Above Upper Band: Strong bullish momentum; may signal trend continuation or exhaustion depending on context
- Price Breaking Below Lower Band: Strong bearish momentum; may indicate capitulation or continuation of downtrend
- Band Width: Wider bands indicate higher volatility and uncertainty; narrower bands suggest consolidation
- Price Between Bands: Normal trading range; price tends to oscillate between support (lower band) and resistance (upper band)
- Band Convergence: Narrowing bands may precede significant price moves or breakouts
Example Usage
use centaur_technical_indicators::candle_indicators::bulk::mcginley_dynamic_bands;
use centaur_technical_indicators::DeviationModel;
pub fn main() {
// fetch the data in your preferred way
// let close = vec![...]; // closing prices
let period = 20;
let deviation_multiplier = 2.0;
let previous_mcginley_dynamic = 0.0; // Use 0.0 for the first calculation
let bands = mcginley_dynamic_bands(
&close,
DeviationModel::StandardDeviation,
deviation_multiplier,
previous_mcginley_dynamic,
period
);
println!("McGinley Dynamic Bands: {:?}", bands);
}
import centaur_technical_indicators as cti
# fetch the data in your preferred way
# close = [...] # closing prices
period = 20
deviation_multiplier = 2.0
previous_mcginley_dynamic = 0.0 # Use 0.0 for the first calculation
bands = cti.candle_indicators.bulk.mcginley_dynamic_bands(
close,
deviation="StandardDeviation",
multiplier=deviation_multiplier,
previous_mcginley_dynamic=previous_mcginley_dynamic,
period=period
)
print("McGinley Dynamic Bands:", bands)
import init, {
candle_bulk_mcginleyDynamicBands,
DeviationModel
} 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 deviationMultiplier = 2.0;
const previousMcginleyDynamic = 0.0; // Use 0.0 for the first calculation
const deviationModel = DeviationModel["StandardDeviation"];
const bands = candle_bulk_mcginleyDynamicBands(
close,
deviationModel,
deviationMultiplier,
previousMcginleyDynamic,
period
);
console.log("McGinley Dynamic Bands:", bands);