Trendoscope

Aligned Moving Average Index

Trendoscope Wizard Updated   
Moving averages are considered as aligned when either all faster moving averages are placed above their next slower moving averages or all faster moving averages are placed below their next slower moving averages. In this script, we are considering moving averages of 5, 10, 20, 30, 50, 100 and 200. User can select different moving average types from input : sma, ema, hma, rma, vwma, wma.

Moving average is considered as positively aligned when close > ma5 > ma10 > ma20 > ma30 > ma50 > ma100 > ma200
Moving average is considered as negatively aligned when close < ma5 < ma10 < ma20 < ma30 < ma50 < ma100 < ma200

Whenever there is positively aligned moving average, alignment value is considered as +1 and whenever there is negatively aligned moving average, alignment value is considered as -1. Aligned moving average index is sum of n periods of alignment value.

We can optionally apply another moving average on this index to see the overall direction.



Release Notes:
Added option include partial alignment.

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.

Disclaimer

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?