HeWhoMustNotBeNamed

Aligned Moving Average Index

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.



Phát hành các Ghi chú: Added option include partial alignment.
Gỡ bỏ khỏi Script Ưa thích Thêm vào Script Ưa thích

Bình luận

Hi @HeWhoMustNotBeNamed,

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.
+3 Phản hồi
@BitsOfCash,

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?
Phản hồi
BitsOfCash HeWhoMustNotBeNamed
@HeWhoMustNotBeNamed, I have looked at it again and you are correct. I must have overlooked the "<" that day. Not sure why. Sorry for the false alarm!
+1 Phản hồi
Trang chủ Bộ lọc cổ phiếu Bộ lọc Forex Bộ lọc Tiền điện tử Lịch kinh tế Cách thức hoạt động Tính năng Biểu đồ Trả phí Giới thiệu bạn Quy tắc Áp dụng Trung tâm Trợ giúp Giải pháp cho Website & Nhà môi giới Widget Giải pháp biểu đồ Thư viện Biểu đồ Lightweight Blog & Tin tức Twitter
Hồ sơ Tùy chỉnh Hồ sơ Tài khoản và Thanh toán Giới thiệu bạn Xu Ticket Hỗ trợ của tôi Trung tâm Trợ giúp Các ý tưởng đã đăng Người theo dõi Đang theo dõi Tin nhắn riêng Trò chuyện Đăng xuất