Hi Samuel,
I've been testing with your indicator and it appears that the Period setting is working backwards.
I've been using an .mq4 McGinley indicator and the Period setting behaves the same as for an MA, the larger the number the flatter the curve becomes.
The way this is working the 60% rule can't be applied.
MT5 Build 1795
There's a difference to the original formula.
You:
MDBuffer[i]=MDBuffer[i-1]+(close[i]-MDBuffer[i-1])/(MD_smooth*(close[i]/MDBuffer[i-1]));
McGinley:
MDBuffer[i]=MDBuffer[i-1]+(close[i]-MDBuffer[i-1])/(0.6*MD_smooth*MathPow(close[i]/MDBuffer[i-1],4));
There's a difference to the original formula.
You:
McGinley:
should we change the code to what you showed as "McGinley" ?
should we change the code to what you showed as "McGinley" ?
There's a difference to the original formula.
You:
McGinley:
I believe i see the error, or oversight, it looks like the formula was taken from:
https://www.investopedia.com/terms/m/mcginley-dynamic.asp
This has a mistake missing the 0.6 constant, and the indicator author has missed the power 4.
The correct formula as lippmaje quoted is in:
https://www.investopedia.com/articles/forex/09/mcginley-dynamic-indicator.asp
So if you want the McGinley Dynamic indicator as McGinley intended I would correct it as advised

- www.investopedia.com
if(useImprovedFormula) { mcg[i] = ma[i+1]+(price-ma[i+1])/MathMin(McgPeriod,MathMax(1,(McgConstant*McgPeriod*MathPow(price/ma[i+1],4)))); //Improved } else { mcg[i] = ma[i+1]+(price-ma[i+1])/(McgConstant*McgPeriod*MathPow(price/ma[i+1],4)); //Original }Here is example mql4 code for original old McGiley formula and the improved version of same formula.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
McGinley Dynamic Indicator:
The McGinley Dynamic indicator is designed to follow prices, avoiding whipsaws that are given when conventional Moving Averages are used.
Conventional Moving Averages have a fixed period and therefore a fixed speed. As a result, price separation occurs when the price moves rapidly which can lead to unwanted results. The McGinley Dynamic however is designed to adjust speed inline with the market.
This tool can be used as a substitute for a conventional Moving Average as a trend confirmation indicator or crossover signal.
There are two inputs for this indicator:
The pictures below show comparisons between the McGinley Dynamic (Red line) and a simple Moving Average (Blue line). The McGinley Dynamic reacts to price increases sooner whilst also tracking closer to prices and reducing whipsaws.
Author: Samuel Williams