OPEN-SOURCE SCRIPT

MMA mainpanel

I stumbled on the MMA in the “Active Investing” course notes by Alan Hull (who invented the Hull Moving Average)
alanhull.com/uploads/documents/Active Investing Course Notes.pdf
He writes on page 13:
“Multiple moving averages, MMAs, are a sophisticated tool that can be used in a range of applications. MMAs are a series of lines that track and filter the weekly price movements. They consist of 2 sets of lines that allow Technical Analysts to observe and compare the immediate behavior of price activity with the long term behavior of the price activity. Exponential moving averages are used for this type of analysis. The price bars in the following chart have been switched off to improve readability of the MMA lines.”
[]
“Once we have found a share that has an acceptable 'Rate of return' we must make a qualitative judgment of the trend. We are looking for a strong and consistent trend that is not likely to reverse shortly after we enter the market. The following points are critical;
- The long term group must be spreading apart or running parallel with each other.
- The long term group must be pointing upwards.
- The straighter the long term group of lines are; the less volatile the trend is.
- The short term group can pullback (ie. compress together) but if they cross into the long term group then the trend is weakening and may be about to break.
This type of qualitative analysis is only used when entering the market and the idea is to avoid volatility. We want to 'Buy and Hold' and not get bounced in and out of the market. Judging the quality of trends is the most subjective function we will have to perform.”

Because I tend to close positions too soon, I tried MMA. I found that it can help me to stay in position as long as the trend is going on. TradingView offers several scripts for MMA, this version differs from the others because I added color zones and linecolor changes to mark the trend according to Alan’s norms:
An uptrend is marked with a blue zone when the short term group is above the long term group and the long term group is sorted correctly and ema50 points up. The zone is purple when vice versa in downtrend. When there is no trend no zone is colored, but the lines are made gray.

Because of Alan’s idea to show MMA without price bars, I created both an overlay version for the main panel and a version for a sub panel.
CyclesMMAMoving AveragesTrend Analysistrendtrading

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 publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer