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)
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.


+1 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
+8 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
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
fpooth hercules1610
@hercules1610, thats a pine script version error... the current version of pine script is Version 3, but this indicator was build on version 2 which had the error of repainting signals. You'd have to rewrite the indicator script :( had the same issue as you
+2 Phản hồi
@fpooth, hello sir, any chance you can share the updated script in V3?
Phản hồi
VI Tiếng Việt
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
HE עברית
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 đồ Quy tắc Áp dụng Người điều hành Giải pháp cho Website & Nhà môi giới Widget Thư viện Biểu đồ Chứng khoán Yêu cầu tính năng Blog & Tin tức Câu hỏi thường gặp Hỗ trợ & Wiki Twitter
Hồ sơ Tùy chỉnh Hồ sơ Tài khoản và Thanh toán Gửi phản hồi 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