MasaNakamura

ADX and DI

40326浏览
22832
40326 23
从常用的脚本中删除 添加到常用的脚本
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)
p=plus,m=minus
t=p>=25 and p>m?1:m>=25 and m>p?0:t
color=t?blue:red
回复
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 回复
Can you do it system tester for adx and di ?
+3 回复
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 回复
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 回复
@rvsw,

Replace:
ADX = sma(DX, len)

With:
ADX = ((nz(ADX) * (len - 1)) + DX) / len
回复
JFX_Xx JFX_Xx
ADX = ((nz(ADX) * (len - 1)) + DX) / len
回复
hello sir, any chance you can share the updated script in V3?
回复
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 回复
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 回复
ZH 简体中文
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 ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 繁體中文
AR العربية
HE עברית
首页 股票筛选器 外汇筛选器 加密货币筛选器 财经日历 如何运作 图表功能 网站规则 版主 网站 & 经纪商解决方案 插件 图表库 功能请求 博客 & 新闻 常见问题 帮助 & 维基 Twitter
概述 个人资料设置 账号和账单 发送反馈 已发表观点 粉丝 正在关注 私人消息 聊天 退出