mohamed982

Hull MA

4936 lượt xem
1602
4936 15
Gỡ bỏ khỏi Script Ưa thích Thêm vào Script Ưa thích
study("HullMA",overlay=true)
n=input(title="period",type=integer,defval=16)


n2ma=2*wma(close,round(n/2))
nma=wma(close,n)
diff=n2ma-nma
sqn=round(sqrt(n))


n2ma1=2*wma(close[1],round(n/2))
nma1=wma(close[1],n)
diff1=n2ma1-nma1
sqn1=round(sqrt(n))


n1=wma(diff,sqn)
n2=wma(diff1,sqn)
c=n1>n2?green:red
ma=plot(n1,color=c)


Hey! Why does the hull ma change from red to green back to red. What moving average crosses are they to have them switch colors? I am trying to code a bot that buys when the hullma is green and sells when the hullma is red, and was wondering which moving averages cause them to change colors. Thanks!
Phản hồi
great indicator. Thank you. Question: If I wanted to add a LONG alert condition to an existing script in which the alert fires ONLY IF the Candle Opening price is BELOW the HMA, or ONLY if the HMA is showing GREEN, do you have any guidance for this? I'm new to coding and can't seem to figure it out
Phản hồi
hello, what is the purpose of line 14 in your code? I don't see the variable sqn1 being used anywhere. Should it be in line 18 instead of sqn?
+1 Phản hồi
mohamed982 pmcrypto
@pmcrypto, are you interested in coding or in using the Indicator ? heheheheheh . and line 14 sqn stands for the square root of n . but you know you are right i didn't use it i don't know why i created this variable , but this is how the average is calculated we always use SQR
Phản hồi
mohamed982 pmcrypto
@pmcrypto, and actually yea it should have been placed on line 18 , but if you notice both sqn & sqn1 are the square root of the same number which is n so they are equal , that is why i just ignored using it again and instead used sqn for consistency
Phản hồi
pmcrypto mohamed982
@mohamed982, Thanks man! I was trying to understand the code and this was throwing me off :)
Phản hồi
Is it possible to get this indicator for metatrader? I use it everyday that I trade. This is the best indicator I have used since I discovered Bollinger Bands!!
+1 Phản hồi
@jamjan33, Did you ever get an answer for this? I really really like the single color changing line but cant seem to find anything similar for my MT4 chart.....
Phản hồi
mohamed982 Mactormind
@Mactormind, it's easy to do for MT4
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 đồ Giá Quy tắc Áp dụng Người điều hành Giải pháp cho Website & Nhà môi giới Widget Giải pháp biểu đồ Trung tâm Trợ giúp Yêu cầu tính năng Blog & Tin tức Câu hỏi thường gặp Wiki Twitter
Hồ sơ Tùy chỉnh Hồ sơ Tài khoản và Thanh toán Đồng TradingView 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