MasaNakamura

ADX and DI

Gỡ bỏ khỏi Script Ưa thích Thêm vào Script Ưa thích
study("ADX and DI")
len = input(title="Length", type=integer, defval=14)
th = input(title="threshold", type=integer, defval=20)

TrueRange = max(max(high-low, abs(high-nz(close[1]))), abs(low-nz(close[1])))
DirectionalMovementPlus = high-nz(high[1]) > nz(low[1])-low ? max(high-nz(high[1]), 0): 0
DirectionalMovementMinus = nz(low[1])-low > high-nz(high[1]) ? max(nz(low[1])-low, 0): 0


SmoothedTrueRange = nz(SmoothedTrueRange[1]) - (nz(SmoothedTrueRange[1])/len) + TrueRange
SmoothedDirectionalMovementPlus = nz(SmoothedDirectionalMovementPlus[1]) - (nz(SmoothedDirectionalMovementPlus[1])/len) + DirectionalMovementPlus
SmoothedDirectionalMovementMinus = nz(SmoothedDirectionalMovementMinus[1]) - (nz(SmoothedDirectionalMovementMinus[1])/len) + DirectionalMovementMinus

DIPlus = SmoothedDirectionalMovementPlus / SmoothedTrueRange * 100
DIMinus = SmoothedDirectionalMovementMinus / SmoothedTrueRange * 100
DX = abs(DIPlus-DIMinus) / (DIPlus+DIMinus)*100
ADX = sma(DX, len)

plot(DIPlus, color=green, title="DI+")
plot(DIMinus, color=red, title="DI-")
plot(ADX, color=black, title="ADX")
hline(th, color=black, linestyle=dashed)
+1 Phản hồi
p=plus,m=minus
t=p>=25 and p>m?1:m>=25 and m>p?0:t
color=t?blue:red
+1 Phản hồi
ADX is the best ,thanks for the script with right value of input parameters and right adjustment i am sure this will generate good profit.
Thanks for helping with code ,I have been searching the code for my project BOT and AutoIndicator work.It really helped a lot to get to a concesus.


+3 Phản hồi
Can you do it system tester for adx and di ?
+3 Phản hồi
03.freeman Kivilcimli
@Kivilcimli, I developed a strategy based on this study. You can find it here
The scope of this startegy is to indentify best settings and inputs for winning signals.
+2 Phản hồi
Thank you for the programming code. However, it seems to be incorrect. I have yet to figure out why so because the programming code . Seems to be logical. As an example, for October, 10, 2018, on a weekly chart, IWM shows ADX level of 38 while the inbuilt directional movement indicator showed 32. Overall, both the Cubs follow the same shape. However, the few points of difference is made a big difference in my back testing and that is why I ended up investigating it more
+9 Phản hồi
@rvsw,

Replace:
ADX = sma(DX, len)

With:
ADX = ((nz(ADX) * (len - 1)) + DX) / len
Phản hồi
JFX_Xx JFX_Xx
ADX = ((nz(ADX) * (len - 1)) + DX) / len
+1 Phản hồi
hello sir, any chance you can share the updated script in V3?
Phản hồi
Hi, it is strange but when I add this indicator to my charts it works fine but when I copy it to use in my own strategy I get an error because of the following line:
SmoothedTrueRange = nz(SmoothedTrueRange) - (nz(SmoothedTrueRange)/len) + TrueRange
because this refers to itself I get the error "Undeclared identifier `SmoothedTrueRange`;"

Any ideas?
Thanks in advance!
+8 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 đồ Nhận 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 Nhận 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