I discovered a lack of constraints in the formulation that either caused the algorithm to implode to near zero and zero OR it could explosively enlarge to near infinite values during unusual price action conditions, occurring on different time frames. A numeric E-notation in a moving average doesn't mean a stock just shot up in excess of a few quintillion in value from just "10ish" moments ago. Anyone experienced with the usual Dynamic, has probably encountered this with dynamically dramatic surprises in their chart, destroying it's usability.
Well, I believe I have found an answer to this dilemma of 'susceptibility to miscalculation', to provide what is most likely McGinley's whole hearted intention. It required upgrading the formulation with two constraints applied to it using min/max() functions. Let me explain why below.
When using base numbers with an exponent to the power of four, some miniature numbers smaller than one can numerically collapse to near 0 values, or even 0.0 itself. A denominator of zero will always give any computational device a horribly bad day, not to mention the developer. Let this be an EASY lesson in computational division, I often entertainingly express to others. You have heard the terminology "$#|T happens!🙂" right? In the programming realm, "AnyNumber/0.0 CAN happen!🤪" too, and it happens "A LOT" unexpectedly, even when it's highly improbable. On the other hand, numbers a bit larger than 2 with the power of four can tremendously expand rapidly to the numeric limits of 64-bit processing, generating ginormous spikes on a chart.
The ephemeral presence of one OR both of those potentials now has a combined satisfactory remedy , AND you as TV members now have it, endowed with the ever evolving "Power of Pine". Oh yeah, this one plots from bar_index==0 too. It also has experimental settings tweaks to play with, that may reveal untapped potential of this formulation. This function now has gain of function capabilities, NOT to be confused with viral gain of function enhancements from reckless BSL-4 leaking laboratories that need to be eternally abolished from this planet. Although, I do have hopes this imd () function has the potential to go viral. I believe this improved function may have utility in the future by developers of the TradingView community. You have the source, and use it wisely...
I included an generic () plot for a basic comparison, ultimately unveiling some of this algorithm's unique characteristics differing on a variety of time frames. Also another unconstrained function is included to display some the disparities of having no limitations on a divisor in the calculation. I strongly advise against the use of umd() in any published script. There is simply just no reason to even ponder using it. I also included notes in the script to warn against this. It's funny now, but some folks don't always read/understand my advisories... You have been warned!
NOTICE: You have absolute freedom to use this source code any way you see fit within your new Pine projects, and that includes TV themselves. You don't have to ask for my permission to reuse this improved function in your published scripts, simply because I have better things to do than answer requests for the reuse of this simplistic imd () function. Sufficient accreditation regarding this script and compliance with "TV's House Rules" regarding code reuse, is as easy as copying the entire function as is. Fair enough? Good! I have a backlog of "computational crises" to contend with, including another one during the writing of this elaborate description.
When available time provides itself, I will consider your inquiries, thoughts, and concepts presented below in the comments section, should you have any questions or comments regarding this indicator. When my indicators achieve more prevalent use by TV members , I may implement more ideas when they present themselves as worthy additions. Have a profitable future everyone!
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.
Over time I have made so many tweaks and adjustments to it
The McGinley Dynamic is the core or center of my TA
having spent quite a few hours playing with your code or should I say your version of the McGinley Dynamic
I have to say wow this is awesome !!!
this is not just a hd remaster its a full on remake from the ground up
But the awesome thing is that YES I totally agree with you "most likely McGinley's wholehearted intention"
You nailed it
I have tried a million times to replace the McGinley Dynamic on my chart but I never found something that was actually able to replace it
BUT now I have
thank you for this publication I am very grateful :) !!!
A brief example, when driving a vehicle straight, roadways have many imperfections causing drift. With this, we always have to make adaptive corrections in steering to be optimally centered in our lane, reducing the "risk" of collision. Without this ability to make micro adjustments easily, driving would be more tumultuous for us. The power steering in MD appears to be a much better driver at higher speeds when traveling down hill. I'm not implying it would be applicable to self-driving vehicles, but who knows...
Just as lag will always plaque moving averages, the McGinley Dynamic effectively minimalizes the lag of ema() specifically in down trends, from my observations. Now that I have provided improved operation for MD, I think another door of exploration has been opened concerning the potential use of OR even adaptation of this algorithm into another enhanced form. It clearly provides a better model than the ordinary ema() in more than one way. I have yet to use it many other complex algorithms that utilize ema(), we'll see.
I like the ema ribbon because it is more responsive than the traditional sma
But this McGinley Dynamic I can adjust the k and exponential values WHICH IS AWESOME !!!
As well as this McGinley Dynamic does not suffer from a lot of the quirks that the original does
just try using the traditional McGinley Dynamic on a 2 day or higher time frame on BTC it does not work at times
so I like the ability to adjust the values I love to tweak and dial in settings
as well as I 100% agree this is staying true to the original vision of the McGinley Dynamic
to me it is in the spirit of that indicator but taking its intention a huge step further
frankly, I have been looking to replace the McGinley Dynamic but I was never able to
the McGinley Dynamic is a core pillar of how I gage or view a chart
@MasBart put the standard McGinley Dynamic on your chart and hop around different time frames with this new one
and you will see
Even if you set this new McGinley Dynamic to the traditional mode or values it still performed better with less anomalies
Mid town sk8rguy is the man !!! and I am 100% grateful to have access to this wonderful algo script :)
A tool in the right hands
or the horses for course
or the right tool for the job :) good luck
I have multiple time frames and patterns that I run indicators though
I love tweaking and adjusting settings and variables :)
If you are ever needing someone to spend 15 hours a day playing with multi-color lines on charts I am your guy (hahahhahaha )