API documentation for pandas_ta.overlap.mcgd Python function.

mcgd(close, length=None, offset=None, c=None, **kwargs)[source]#

McGinley Dynamic Indicator

The McGinley Dynamic looks like a moving average line, yet it is actually a smoothing mechanism for prices that minimizes price separation, price whipsaws, and hugs prices much more closely. Because of the calculation, the Dynamic Line speeds up in down markets as it follows prices yet moves more slowly in up markets. The indicator was designed by John R. McGinley, a Certified Market Technician and former editor of the Market Technicians Association’s Journal of Technical Analysis.


Default Inputs:

length=10 offset=0 c=1

def mcg_(series):

denom = (constant * length * (series.iloc[1] / series.iloc[0]) ** 4) series.iloc[1] = (series.iloc[0] + ((series.iloc[1] - series.iloc[0]) / denom)) return series.iloc[1]

mcg_cell = close[0:].rolling(2, min_periods=2).apply(mcg_, raw=False) mcg_ds = close[:1].append(mcg_cell[1:])


close (pd.Series): Series of ‘close’s length (int): Indicator’s period. Default: 10 offset (int): Number of periods to offset the result. Default: 0 c (float): Multiplier for the denominator, sometimes set to 0.6. Default: 1


fillna (value, optional): pd.DataFrame.fillna(value) fill_method (value, optional): Type of fill method


pd.Series: New feature generated.