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.
I am new to TradingView so I decided to check out some public scripts to get started. Thanks for sharing this script!
I read through your script and was wondering if I have spotted an oversight or an intentional skewing of your partial alignment scoring. It seems to me that there are 6 upward scores that can result in partial scoring (1,2,3,4,5,6), leaving 0 and 7 for full alignment.
With your formula on line 49, an upward score of 1 or 2 can result in -0.5, while only 6 can result in 0.5; similarly only 3 can result in -0.25, while 4 and 5 can result in 0.25. Was this unbalanced scale intentional? Again, I am very new to this, so I am sure its possible that I am just not understanding the intended behaviour of this indicator.
I don’t think so. I have used < 2. Hence only score 1 can result in -0.5
7 => +1
6 => +0.5
4,5 => 0.25
3,2 => -0.25
1 => -0.5
0 => -1
Do you think the code isn’t reflecting this?