Here is the formula, supposedly (from Investopedia): It works ok for smallish price variations, but let's say the price suddenly goes down - a lot - maybe 75%, and stays there. Then the 4th power of Close/MDi-1 becomes tiny, the new MD becomes a fairly big negative, and repeated several times for the next few data points, the whole thing falls apart into NaNs. If anyone is familiar with this indicator, how is this handled?
For now I made it reset itself to Close when it goes <=0. But in googling around, I haven't seen anyone mention this problem. Weird.
https://in.tradingview.com/script/AKsKg1ih-McGinley-Dynamic-Improved-John-R-McGinley-Jr/ Here is improved version from tradingview