Recursive Moving Average Difference

The relative difference between a moving average and the price can be a useful tool for interpreting trend direction and identifying pullbacks or breakdowns. This indicator recursively finds all the relative moving average differences between two simple moving averages of your choosing and weighs them by their lengths. It then returns a value that represents the weighted average of all the moving average differences. This can represent the gradient of motion between moving averages, or the path of least resistance, which the price may revert to in certain situations.

For the settings: minimum MA represents the minimum simple moving average to consider for the total weighted average. Maximum MA represents the maximum simple moving average to consider. "Move By" is the increment that you want to move between these two moving averages.

A positive moving average difference indicates that the price is above the moving average difference (i.e. the weighted average of all moving average differences between your two selected moving averages). A negative moving average difference indicates that the price is below the moving average difference. I have added a signal with a configurable length input as well to smooth out trends.

You can configure colors and lengths, as well as the counting increment. Future updates may include different ways to calculate weights, perhaps on overlay or strategy.

Invite-only algorithms: www.patreon.com/wbburgin/membership

Use my strategies on CryptoRobotics: cryptorobotics.co/?trade=f23b09

Contact me and I can build you a custom Tradingview-to-broker/exchange automation (via AWS).
Open-source script

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.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?